Introduction to JavaScript – Variables: Undefined

You are here: Home » MiltonMarketing Blog » Computer Programming Languages » JavaScript » Course 1 - Intro To JavaScript » Introduction to JavaScript – Variables: Undefined
  • Introduction to JavaScript - Variables: Undefined

Introduction to JavaScript – Variables: Undefined

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:

MiltonMarketing.com Related Videos.

Related Links:

JavaScript Glossary – Variables

My little pony learning game in VB.NET

Python Glossary

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

W3Schools – Undefined

About the Author:

I am a loving father, & husband. I am a computer enthusiast. I have used and enjoyed computers since I was young and I enjoy teaching young minds how to code, because it teaches them how to think. Today with YouTube, and social media garbage our youth are losing the ability to think on their own and solve problems. I believe this is a serious epidemic as kids today dont understand that technology is a tool. This tool is being abused, and its underlying effects are taking its toll on kids behaviour, and learning.