'null'
behaves as false in boolean context.
var x = null; if(x){ console.log("null is evaluated to true in boolean context"); }else{ console.log("null is evaluated to false in boolean context"); }
Output
null
is evaluated to false in boolean context
'null'
is evaluated to 0 in numeric context.
HelloWorld.js
var x = null; var y = x + 10; console.log("Value of y is : " + y);
Output
Value
of y is : 10
No comments:
Post a Comment