What is the difference between const, let and var
1 min readJan 31, 2020
const
const iNeverChange = "written in stone"iNeverChange = "erase things written in stone"// ERROR
let
let a = 50;if(a === 50) { let a = 100 }console.log(a)
// 50the value remained 50 even though we reassigned the variable a to 100. This shows the block scope nature of let declaration.
var
var a = 50;if(a === 50) { var a = 100 }console.log(a)
// 100the value changed to 100