check space in string in js code example
Example 1: javascript detect space in string
if(str.indexOf(' ') >= 0){
console.log("contains spaces");
}
Example 2: js find space in string
if(str.indexOf(' ') >= 0){
console.log("contains spaces");
}