DEV Community

Discussion on: What is the difference between 'Var' and 'Let' ?

Collapse
 
luctst profile image
Lucas.T • Edited

Hey 👋,

I think you can add the fact that you can update the value of an let variable but never a const variable.

Let example:

let x = 0
x = 1
console.log(x) // 1

Const example:

const x = 0
x = 1
console.log(x) // TypeError cannot reassign x

Otherwise it is a nice article.

Collapse
 
frk_ozbk profile image
frk-ozbk

Thank you,

I just want to focus on the differences between let and var in this post.