Ambiguity between var or const [duplicate]

I'm new to nodejs. I've been watching tutorials on Youtube and some use 'const' as opposed to 'var' which I'm familiar with in Javascript. I figured 'const' should mean constant and 'var'-variable. But I still don't get it. Why would you need to use 'const' instead of 'var'?


Solution 1:

A similar question here:

Const in javascript? When to use it and is it necessary

If you are using ES6, you may want to look into using "let" vs "var". "let" is a safer choice as it is scoped and var is not. You can read more about that here:

https://medium.com/javascript-scene/javascript-es6-var-let-or-const-ba58b8dcde75#.xhhshyeaa