Javascript Variable scope || Related to var
Fri Aug 18 2023 13:47:57 GMT+0000 (Coordinated Universal Time)
Saved by
@mdfaizi
var arOverdueAmount = 56356; // This initializes the variable with the value 56356
var arOverdueAmount; // This declaration is ignored, as the variable already exists
console.log(arOverdueAmount); // Prints the value assigned earlier, which is 56356
var arOverdueAmount = 56356; // This initializes the variable with the value 56356
var arOverdueAmount = 10000; // This updates the value of the variable to 10000
console.log(arOverdueAmount); // Prints the updated value, which is 10000
If you declare a variable with the same name in the same scope but don't provide a new value, the existing value of the variable will remain unchanged.
content_copyCOPY
Comments