DEV Community


Discussion on: Vanilla JS, back to basics (Part 2: Hoisting)

codevault profile image
Sergiu Mureşan

There is a fine difference between

function a() { ... }
Enter fullscreen mode Exit fullscreen mode


var a = function() { ... }
Enter fullscreen mode Exit fullscreen mode

in that one is a named function and another is a variable that has an anonymous function as its value. I saw this making a pretty big difference in code editors.

We should always use let in our javascript projects. Hoisting is one reason you've underlines pretty well in this thread. We actually made a video that includes this and 2 more reasons to stop using var in js: