1function IsEmptyOrWhiteSpace(str) {
2 return (str.match(/^\s*$/) || []).length > 0;
3}
1if (variable === null) { //Executes only if variable is null but not undefined
2 //Code here
3}
4
5if (variable == null) { //Executes if variable is null OR undefined
6 //Code here
7}
1var myVar=null;
2
3if(myVar === null){
4 //I am null;
5}
6
7if (typeof myVar === 'undefined'){
8 //myVar is undefined
9}
10
1// Test whether strValue is empty or is None
2if (strValue) {
3 //do something
4}
5// Test wheter strValue is empty, but not None
6if (strValue === "") {
7 //do something
8}
1var string = "not empty";
2if(string == ""){
3 console.log("Please Add");
4}
5else{
6 console.log("You can pass"); // console will log this msg because our string is not empty
7}