Programming Code Center(PCC)
[JS]

(PCC)::[How-to-Re-declaring-a-variable-will-not-destroy-the-value-in-JavaScript]::[js]

File Name : index.html

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Variables</h2>

<p>If you re-declare a JavaScript variable, it will not lose its value.</p>

<p id="demo"></p>

<script>
var carName = "Volvo";
var carName;
document.getElementById("demo").innerHTML = carName;
</script>

</body>
</html>


Output :

JavaScript Variables

If you re-declare a JavaScript variable, it will not lose its value.