Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Undefined | Data Types and Variables
Introduction to JavaScript

Swipe to show menu

book
Undefined

What is Undefined

Undefined is also a data type in JavaScript just like the null. When a variable is created or declared without assigning any value to it, then the value of the variable will be set as undefined by default.

12
let age; console.log(age);
copy
Task

Swipe to start coding

Declare a variable numberOfItems and assign the value of undefined to the variable and show the value of the variable.

Solution

So, undefined variables can also be declared using the undefined keyword.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 31
We're sorry to hear that something went wrong. What happened?

Ask AI

expand
ChatGPT

Ask anything or try one of the suggested questions to begin our chat

book
Undefined

What is Undefined

Undefined is also a data type in JavaScript just like the null. When a variable is created or declared without assigning any value to it, then the value of the variable will be set as undefined by default.

12
let age; console.log(age);
copy
Task

Swipe to start coding

Declare a variable numberOfItems and assign the value of undefined to the variable and show the value of the variable.

Solution

So, undefined variables can also be declared using the undefined keyword.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 31
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt