Home » 2021
What is ‘undefined’ in JavaScript?
This short article will explain what ‘undefined’ means in JavaScript – as both a type and a variable value. Creating a Variable with an undefined value To create a variable with an undefined value, it simply needs to be declared with no assigned value, for example: var myVariable; console.log(myVariable); If the above code is executed, undefined is logged as the value of myVariable as no value was assigned. undefined is a Type of Variable undefined is one of the primitive variable types in JavaScript. A variable type describes what a variable can be used for (for … Read more