0
How many type of variable in JS and what kind of use?
How many type of variable in JS and what kind of use?
var x = 5;
var y = 6;
var z = x + y;
console.log('The value of z is: ' + z);
let x = 'MindStick pvt ltd';
let x = 0;
// SyntaxError: 'x' has already been declared
var x = 2; // Allowed
let x = 3; // Not allowed
{
let x = 2; // Allowed
let x = 3 // Not allowed
}
{
let x = 2; // Allowed
var x = 3 // Not allowed
}
const PI = 3.141592653589793;
PI = 3.14; // This will give an error
PI = PI + 10; // This will also give an error