1.const a=1; //a will not be changed.
2.
const a=1;
a=2; //TypeError: Assignment to constant variable.
3.
const a=1;
const a=2; //SyntaxError: Identifier 'a' has already been declared
4.
const a; //SyntaxError: Missing initializer in const declaration
5.
const obj = {"name":"axe"};
const obj = {"name": "axe2"}; //SyntaxError: Identifier 'obj' has already been declared
obj = {"name":"spe"}; //TypeError: Assignment to constant variable
obj = {"name2":"spe"}; //TypeError: Assignment to constant variable
obj.name = "spe"; //spe
6.
{
var a = 1;
}
console.log(a); //1
{
const b = 2;
}
console.log(b); //ReferenceError: b is not defined