Skip to content

Instantly share code, notes, and snippets.

@yangsu
Last active December 11, 2015 22:09
Show Gist options
  • Save yangsu/4667566 to your computer and use it in GitHub Desktop.
Save yangsu/4667566 to your computer and use it in GitHub Desktop.
JavaScript Variables
dontDoThis = 'ever !!!';
var a;
if (a === undefined){
console.log('a is ' + a); // 'a is undefined'
}
if (b) {} // this will generate an error "ReferenceError: b is not defined"
var n = null;
console.log(n * 32); // 0. Note: implicit type conversion
var c = 1, d, e = {};
console.log(c, d, e); // 1 undefined {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment