Question on let/var and const/function

This is more of a general query rather than about specific code. I am working my way through the Return II tutorial and have been using var and function. In these forums I see a lot of people using let instead of var, and const instead of function. Why is this? It seems that let and const might be a new standard, but if so, why are my tutorials still using the old ones?

let and const where introduced in es6 (released in 2015), they offer a block scope rather then a function scope (var)

there are two Javascript courses:

https://www.codecademy.com/learn/learn-javascript

https://www.codecademy.com/learn/introduction-to-javascript

the last one teaches es6

3 Likes

Ok thanks for your reply. Should I be working through the introduction to JavaScript course instead then? Or do both?

1 Like

I think you should learn es6, if the browser support isn’t enough for your website you can always transpile the code into es5 using webpack.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.