Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript regex check if string is empty

function IsEmptyOrWhiteSpace(str) {
    return (str.match(/^s*$/) || []).length > 0;
}
Comment

regex is empty string javascript

const REGEXP = /^$/;

const validate = (text) => {
    return REGEXP.test(text);
}

const isEmpty = validate("");
const isNotEmpty = validate("x");

console.log(isEmpty); //true
console.log(isNotEmpty); //false
Comment

javascript check if string is empty

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
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: js check if object has property 
Javascript :: angular find value in json array 
Javascript :: header in axios 
Javascript :: select all checkboxes html js 
Javascript :: javascript get object from array where property equals 
Javascript :: react-router-dom v6 redirect 
Javascript :: speed facebook video 
Javascript :: get number from string javascript 
Javascript :: prisma studio 
Javascript :: mongoose generate new ObjectID 
Javascript :: how to redirect in ionic react 
Javascript :: modulo do angular httpclient 
Javascript :: float force loopback 
Javascript :: javascript append how first element 
Javascript :: js random int 
Javascript :: javascript split array into chuncks of 
Javascript :: js loop over object 
Javascript :: less than or equal js 
Javascript :: javascript try catch finally 
Javascript :: math floor javascript null 
Javascript :: youtube skip 
Javascript :: how to clamp a value 
Javascript :: form serialize to json 
Javascript :: jquery on change function not working 
Javascript :: Codewars Returning Strings 
Javascript :: regex pater for only 4 or 6 digits 
Javascript :: Concatenating variables and strings in React 
Javascript :: how to setItem and getItem in javascript in localStorage 
Javascript :: why my bootstrap classes is not working on onclick event in react 
Javascript :: js copy a div 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =