how to check is a string containes spaces in js code example Example: js find space in string if(str.indexOf(' ') >= 0){ console.log("contains spaces"); }