Skip navigation

The history

Javascript!!! The World’s Most Misunderstood Programming Language. 

The tiny little word always gives me shock whenever I touch. For quite some time, I have been in this web development field, now I dare to break this idot. 🙂

So I decided to start from scratch. As usual  it gave me shock while reading almost evey concept. After some time, Im comfortable to blog about Javascript to share my experience.

Now I really love this tiny, cute idot. 🙂

undefined, null, “”

Here is basic snippet to test your code…

<html>
<head>
<script type="text/javascript">
function check() {
// put your code here
}
</script>
</head>
<body>
<a href="javascript:check()">check</a>
</body>
</html>

Now try with following code at //

var k;
alert(k);

 You will get undefined as value. You will get undefine as popup value since k defined but not initialised to none.

Here are some experiments. I used http://rainbow9.org/ to test myself

null==null
null==undefined
null==””
null==true
null==false
null==0
null==NaN
null=Infinity

undefined==undefined
undefined== null
undefined==””
undefined==true
undefined==false
undefined==0
undefined==NaN
undefined==Infinity

NaN==NaN
NaN==null
NaN==undefined
NaN==””
NaN==true
NaN==false
NaN==0
NaN==Infinity

Infinity==Infinity

var x; now value of x is undefined
var x=12/x; now value of x is NaN
var x = 12/0;  now value of x is Infinity
var x=null; now value of x is null
var x = “”; now value of x is empty string “” 
var x = 0; now value of x is zero

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: