Instantly share code, notes, and snippets.

Embed
What would you like to do?
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