Javascript Undefined Values
In a program the variables declared gets the value at the time of the variable declaration or get assigned after some calculation or received by the user input, but the variables which are not assigned any value at the time of the declaration are Undefined variables.
We can say that the variables declared without a value have the value undefined.
For Example:
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
var name;
document.getElementById("demo").innerHTML = name;
</script>
</body>
</html>
Output
undefined
As in the above example the variable name declared but didn't assigned any value that means the variable has a value Undefined. So, as a result we get the output as undefined.
0 Comment(s)