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

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 str…


This content originally appeared on DEV Community and was authored by Coderslang: Become a Software Engineer

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


This content originally appeared on DEV Community and was authored by Coderslang: Become a Software Engineer


Print Share Comment Cite Upload Translate Updates
APA

Coderslang: Become a Software Engineer | Sciencx (2021-05-13T12:57:04+00:00) JavaScript Interview Question #40: What is the type of `undefined` in JS?. Retrieved from https://www.scien.cx/2021/05/13/javascript-interview-question-40-what-is-the-type-of-undefined-in-js/

MLA
" » JavaScript Interview Question #40: What is the type of `undefined` in JS?." Coderslang: Become a Software Engineer | Sciencx - Thursday May 13, 2021, https://www.scien.cx/2021/05/13/javascript-interview-question-40-what-is-the-type-of-undefined-in-js/
HARVARD
Coderslang: Become a Software Engineer | Sciencx Thursday May 13, 2021 » JavaScript Interview Question #40: What is the type of `undefined` in JS?., viewed ,<https://www.scien.cx/2021/05/13/javascript-interview-question-40-what-is-the-type-of-undefined-in-js/>
VANCOUVER
Coderslang: Become a Software Engineer | Sciencx - » JavaScript Interview Question #40: What is the type of `undefined` in JS?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/05/13/javascript-interview-question-40-what-is-the-type-of-undefined-in-js/
CHICAGO
" » JavaScript Interview Question #40: What is the type of `undefined` in JS?." Coderslang: Become a Software Engineer | Sciencx - Accessed . https://www.scien.cx/2021/05/13/javascript-interview-question-40-what-is-the-type-of-undefined-in-js/
IEEE
" » JavaScript Interview Question #40: What is the type of `undefined` in JS?." Coderslang: Become a Software Engineer | Sciencx [Online]. Available: https://www.scien.cx/2021/05/13/javascript-interview-question-40-what-is-the-type-of-undefined-in-js/. [Accessed: ]
rf:citation
» JavaScript Interview Question #40: What is the type of `undefined` in JS? | Coderslang: Become a Software Engineer | Sciencx | https://www.scien.cx/2021/05/13/javascript-interview-question-40-what-is-the-type-of-undefined-in-js/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.