function IsEmptyOrWhiteSpace(str) {
return (str.match(/^s*$/) || []).length > 0;
}
const REGEXP = /^$/;
const validate = (text) => {
return REGEXP.test(text);
}
const isEmpty = validate("");
const isNotEmpty = validate("x");
console.log(isEmpty); //true
console.log(isNotEmpty); //false
var string = "not empty";
if(string == ""){
console.log("Please Add");
}
else{
console.log("You can pass"); // console will log this msg because our string is not empty
}