Seems pretty simple, but cannot figure out why this javascript code isn\'t working returning false, when expecting true) - I\'m guessing it has got to do something with the esca
You need to escape the backslash if you are creating your RegExp object from a string literal:
var inValid = new RegExp("[\\s]");
Alternatively you can just use the following:
var inValid = /\s/;
This uses a regular expression literal so the escaping of the backslash is not necessary, and there is no need for the character class here so I dropped the square brackets as well.