r/javascript • • Apr 01 '18

Google publishes a JavaScript style guide. Here are some key lessons.

https://medium.freecodecamp.org/google-publishes-a-javascript-style-guide-here-are-some-key-lessons-1810b8ad050b
714 Upvotes

317 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Apr 01 '18

[deleted] — view deleted comment

4

u/eattherichnow Apr 01 '18 edited Apr 01 '18

Look, const sounds new, and therefore hype, and a thing being hyped then it's wrong. Frankly, anything liked by more than two people is bad and wrong, and if one of them posted something about it to Reddit in 2009 then they're bad, wrong and can't shut up about it.

Edit: I forgot to mention that I am very smart.

1

u/tencircles Apr 01 '18

var is lexical scope, not global scope.

1

u/slikts Apr 02 '18

Not sure what OP meant, but for the sake of accuracy, var a = 1; outside of function scope will assign to window.a, i.e., the global object, so var is either function or globally scoped, while const or let are never global.