variable assignment javascript code example
Example 1: var javascript
var is a keyword to define the varible in js but as of es-6 we, use let and const keywords for the same
Example 2: js var
function x() {
y = 1; // Genera un ReferenceError in strict mode
var z = 2;
}
x();
console.log(y); // scrive "1" in console
console.log(z); // Genera un ReferenceError: z non è definita fuori dalla funzione x