I'm looking for smart, fast and simple way to check if the string contains all of the predefined char's.
For example:
var required = 'cfov'; //These are the char's to test for.
var obj = {valid: 'vvcdfghoco'}; //Valid prop can contains any string.
//what I have so far::
var valid = obj.valid, i = 0;
for(; i < 4; i++) {
if(valid.indexOf(required.chatAt(i)) === -1) {
break;
}
}
if(i !== 3) {
alert('Invalid');
}
Can we do it in RegExp? if yes, any help plz!
Thanks in Advance.