Question : Finding spaces in text javascript

I have the following function and regular expression to find white spaces, but it returns true no matter what the text is.
Code Snippet:
1:
2:
3:
var reWhitespace = /(\s)/;
var found = ABN.match(reWhitespace);
if(!found){}
Open in New Window Select All

Answer : Finding spaces in text javascript

this
1:
2:
3:
4:
ABN = " asdf";
var reWhitespace = /\s/g;
var found = ABN.match(reWhitespace);
if(!found){alert("true");}
Open in New Window Select All
Random Solutions  
 
programming4us programming4us