what is the difference between let and var and const in javascript code example
Example 1: what is the difference between let and const in javascript
The difference is that with const you can only only assign a value to a variable
once, but with let it allows you to reassign after it has been assigned.
Example 2: difference between var let and const in javascript with example
var a;
a=10;
let a;
a=10;
let a =20;
if(true){
let b =30;
}
console.log(b);
const
const a;
const a =20;
if(true){
const b =30;
}
console.log(b);
console.log(a);