re: ES6 for beginners with example VIEW POST


Nice post and good examples, thanks! Although I don't understand why so many examples use let over const. I think it's better to use const wherever you can. Is there a reason to consider the opposite?


Because let will never throw an error and is seen as the successor of var, while const is more restrictive.
You are right though, as long as you write ES6 always use const unless you see you explicitly need to change the variable reference, like for counters and booleans

code of conduct - report abuse