+ 3
Testing Characters in JavaScript
How do you test if a specific character is in a string in JavaScript?
2 Réponses
+ 5
Check if the indexOf() function does not return -1
if(theString.indexOf(theCharacter) != -1){
Character in string
}
+ 2
var=theString.indexOf(theChracter) will return the index of theCharacter also if it exists, and can take Regular expressions too.