Answers for "js if string is whitespace"

-1

check whitespace in javascript

if (/s/.test(str)) {
    // It has any kind of whitespace
}
Posted by: Guest on August-04-2020
43

find whitespace in string js

var containsWhitespace = function(str){
	return /s/g.test(s);
};
console.log(containsSpaces("foo bar"));//Returns true
console.log(containsSpaces("foobar"));//Returns false
Posted by: Guest on November-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language