How to check undefined, empty and null in JavaScript/JQuery ?

By Hardik Savani | January 12, 2016 | | 1945 Viewer | Category : Javascript jQuery


If you are working on jquery and However you want to check variable is undefined or not then you can easily check by typeof operator, which is simple, fast and cross-platform:

if(typeof i == "undefined"){

alert('undefined');

}

If you are working on jquery and However you want to check variable is empty or not then you can easily check by compare with empty string:

if(i == ''){

alert('Empty');

}

If you are working on jquery and However you want to check variable is null or not then you can easily check by compare with "null":

if(i == null || i == NULL){

alert('null');

}

Try this......


Do you want to expert php developer or developer team for your projects ?
Contact US