Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Function Declaration vs Function Expressions
// This declaration is moved to the top before the JS is executed.
function hoistedFunction() {
console.log('Hoisted function. Bad!');
// If we tried to call this function before this expression, JS would throw an error!
const nonHoistedFunction = function() {
console.log('Not hoisted! Good!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.