Programming Code Center(PCC)
[JS]

(PCC)::[How-A-variable-without-a-value-returns-the-value-undefined-in-JavaScript]::[js]

File Name : index.html

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Variables</h2>

<p>A variable declared without a value will have the value undefined.</p>

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

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

</body>
</html>


Output :

JavaScript Variables

A variable declared without a value will have the value undefined.