Introduction to JavaScript – Variables: Undefined
What happens if you create a variable, but don’t assign it a value?
JavaScript creates space for this variable in memory and sets it to undefined. Undefined is the fifth and final primitive data type. JavaScript assigns the undefined data type to variables that are not assigned a value.
Introduction to JavaScript – Variables: Undefined
let whatAmI; console.log(whatAmI);
OUTPUT: undefined
In the example above, we created the variable whatAmI without any value assigned to it. JavaScript creates the variable and sets it equal to the value undefined.
Related Videos:
Related Links:
JavaScript Glossary – Variables
My little pony learning game in VB.NET
Learn about programming Classes and Objects in Python
Why do most sites use cookies?
Hello World Android app built with Android Studio
How to make a go-back button with PHP code?
Introduction to JavaScript – Control Flow: if/else Statements
Introduction to JavaScript – Control Flow: True and False values
Introduction to JavaScript – Data Types
Introduction to JavaScript – Properties
How to make a Go-Back Input button with inline JavaScript
Introduction to JavaScript – Variables: Review
Introduction to JavaScript – Review Types and Operators
Online JavaScript Compiler. Code on the go.
Introduction to JavaScript – Create a Variable: let
Introduction to JavaScript – Create a Variable: const
Why Python is the cooler programming language
Introduction to JavaScript – Variables: String Interpolation