Null & Undefined
Learn two more variable types in JavaScript: null and undefined. Learn what they represent, how they differ, and how to use them.
We'll cover the following...
There are two more variable types that we should discuss.
undefined
undefined
is meant to represent the idea that something doesn’t exist. When we try to use a variable that has no value, we get undefined
. Here’s an example.
Press + to interact
let variable;console.log(variable); // -> undefined
When we declare a variable using let
but don’t give it a value, it receives the default value of undefined
. This is JavaScript ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy