Answers for "check string contain space javascript"

2

javascript check if blank space

function isEmptyOrSpaces(str){
    return str === null || str.match(/^ *$/) !== null;
}
Posted by: Guest on July-01-2021
4

how to check if a string contains only spaces in javascript

let str = "    ";
if (!str.replace(/\s/g, "").length) {
  console.log("string only contains whitespace (ie. spaces, tabs or line breaks)");
}
Posted by: Guest on May-17-2021

Code answers related to "check string contain space javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language