Saturday, December 20, 2014

Difference between null and undefined in jQuery?

Null:


When user declares the variable values as empty in jQuery
Ex:

var a="";

function stringwrite()
{
alert(a) ; //Its shows null
}
undefined:

When user declares the variable values as none in jQuery


Ex:

var a;


function stringwrite()
{
alert(a) ; //Its shows undefined
}

3 comments: