DEV Community

Discussion on: A Quick Look At Hoisting in JavaScript

Collapse
 
jarek profile image
Jarosław Księżuk

There is a difference between a function declaration and a function expression.

Functions defined using an expression are not hoisted.

You can read more here: w3schools.com/js/js_function_defin...

Check all of types and try to understand it correctly ;-)

function test() {}

const test = function() {}

const test = () => {}

(function () {
var test = 1;
})();