Skip to content

Instantly share code, notes, and snippets.

@danielimmke
Last active July 11, 2018 00: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 danielimmke/27df25c5a77b85dccd745db380edec15 to your computer and use it in GitHub Desktop.
Save danielimmke/27df25c5a77b85dccd745db380edec15 to your computer and use it in GitHub Desktop.
console.log(hoistedVar); // "undefined" - hoisted declaration only
console.log(nonHoistedConst); // Throws an actual error in JS: nonHoistedConst is not defined
var hoistedVar = "Hoisted";
const nonHoistedConst = "Definitely not hoisted";
console.log(hoistedVar); // Actually displays the value of the variable.
console.log(nonHoistedConst);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment