This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Variables declared by default are undefined | |
console.log("Begin example - 2"); | |
var x,y = 10; | |
console.log("Value of x = " + x); // X value is not defined, hence has undefiend | |
console.log("Value of y = " + y); | |
// Types demystified | |
console.log("Type of x = " + typeof(x)); // Type of undefined is undefined. | |
console.log("--"); | |
var a=null; | |
var b=0; | |
console.log("Value of a = " + a); // a value is null | |
console.log("Value of b = " + b); | |
console.log("Type of a = " + typeof(a)); // Type of null is object. | |
console.log("--"); | |
var c = a/b; | |
console.log("Value of c = " + c); | |
console.log("Type of c = " + typeof(c)); // Type of NaN is number. | |
console.log("--"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment