Skip to content

Instantly share code, notes, and snippets.

@jw-jenrise
Created January 24, 2018 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jw-jenrise/032008d4ed094f5606f098b5969ee0da to your computer and use it in GitHub Desktop.
Save jw-jenrise/032008d4ed094f5606f098b5969ee0da to your computer and use it in GitHub Desktop.
// 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