Skip to content

Instantly share code, notes, and snippets.

@alordiel
Created July 20, 2017 08:30
Show Gist options
  • Save alordiel/c4245cd05bdd07676670ebd575a1f515 to your computer and use it in GitHub Desktop.
Save alordiel/c4245cd05bdd07676670ebd575a1f515 to your computer and use it in GitHub Desktop.
JS varaible types and definitions
var a;
var b = "";
var c = 0;
var d = null;
var e = [];
var f = {};
var g = false;
console.log("a: " + typeof a); // "undefined"
console.log("b: " + typeof b); // "string"
console.log("c: " + typeof c); // "number"
console.log("d: " + typeof d); // "object"
console.log("e: " + typeof e); // "object"
console.log("f: " + typeof f); // "object"
console.log("g: " + typeof g); // "boolean"
console.log("h: " + typeof h); // "undefined"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment