JavaScript Interview Question #40: What is the type of `undefined` in JS?

coderslang

Coderslang: Become a Software Engineer

Posted on May 13, 2021

JavaScript Interview Question #40: What is the type of `undefined` in JS?

js-test-40

What's the output?

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

In JavaScript, the typeof operator always returns a string.

So, even though typeof undefined evaluates to undefined, it’s a string and not the primitive undefined value.

The string ’undefined’ is not equal to the value undefined.


ANSWER: the message false will appear in the console.

Learn Full-Stack JavaScript

💖 💪 🙅 🚩

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related