r/javascript • • May 28 '19

What are some JavaScript things beginners don't know?

333 Upvotes

383 comments sorted by

View all comments

Show parent comments

0

u/[deleted] May 28 '19

[deleted]

33

u/[deleted] May 28 '19

VSCode masterrace but WebStorm is right here. (Modern) JS shouldn't use var when not explicitly needed.

8

u/g0liadkin May 28 '19

I'm curious, would you say there is a situation when it's actually needed to use var?

5

u/[deleted] May 28 '19

I imagine it can be more convinent sometimes to have a function-scoped variable. But even then we're probably talking about quickly hacking things together.

Out of the blue I cannot give you a production example of "a var variable would be better here"

8

u/turntopage294 May 28 '19

Out of the blue I cannot give you a production example of "a var variable would be better here"

I couldn't even give you a textbook example...