Skip to content

Instantly share code, notes, and snippets.

@jw-jenrise
Created Jan 24, 2018
Embed
What would you like to do?
// 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