Skip to content

Instantly share code, notes, and snippets.

@DaniGithub
Created April 17, 2016 08:14
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 DaniGithub/dd58a8767c0f987733c2231a7be586fa to your computer and use it in GitHub Desktop.
Save DaniGithub/dd58a8767c0f987733c2231a7be586fa to your computer and use it in GitHub Desktop.
JavaScript data types (typed values)
var a;
typeof a; // "undefined"
a = "hello world";
typeof a; // "string"
a = 42;
typeof a; // "number"
a = true;
typeof a; // "boolean"
a = null;
typeof a; // "object" -- weird, bug
a = undefined;
typeof a; // "undefined"
a = { b: "c" };
typeof a; // "object"
-------------------------------------------------------------
a = [];
typeof a; // object
a = function() {};
typeof a; // function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment