IT-info > JavaScript

JavaScript

Javascript - Empty variable info

Calling a variable when it's been declared but no value whatsoever has bees assigned to it

Example:

var x;

alert(x);
console.log = x;
document.getElementById("jsbox").innerHTML = x;

Output:
alert dialog - undefined
console log - undefined
jsbox - undefined

Calling a variable when it's been declared and assigned with the value null

Example:

var x;

x = null;

alert(x);
console.log = x;
document.getElementById("jsbox").innerHTML = x;

Output:
alert dialog - null
console log - null
jsbox -