Saturday, June 12, 2010

Some valid conditions that always returns true in Javascript

Following are illustrations of definte conditions which will always return true in javascript...

if(1) alert("block 1 executed");

if(1.0) alert("block 1.0 executed");

if ( true) alert("block true executed");

var obj=document.body;
if(obj) alert("block object executed");

Click the button to test these conditions:

No comments:

Post a Comment