typeof NaN
JavaScript Data Types and Conversions Quiz
Want to learn more than this quiz offers you? Have a look at my Frontend web
development courses.
Create an account and save your quiz results
Login and save your results
OR
Question 1/15
What is `typeof NaN` in JavaScript?
typeof NaN
Select your answer
Question 2/15
What is `['a', 'b', 'c'].length` in JavaScript?
let arr = ['a', 'b', 'c'];
arr.length
Select your answer
Question 3/15
How do you correctly check if a variable is a string in JavaScript?
Select your answer
Question 4/15
What result will `typeof undefined` produce?
typeof undefined
Select your answer
Question 5/15
What will the expression `!!"text"` evaluate to in JavaScript?
!!"text"
Select your answer
Question 6/15
Which of the following is a primitive data type in JavaScript?
Select your answer
Question 7/15
What does the `===` operator compare?
Select your answer
Question 8/15
How can you express the floating-point number 12.5 using scientific notation in JavaScript?
Select your answer
Question 9/15
What value is returned by the expression `Number(undefined)` in JavaScript?
Number(undefined)
Select your answer
Question 10/15
What does `parseFloat("12.34abc")` return in JavaScript?
parseFloat("12.34abc")
Select your answer
Question 11/15
If `let x;`, what is `x` initialized to?
let x;
Select your answer
Question 12/15
How can you check if a number is not a number using a built-in JavaScript function?
Select your answer
Question 13/15
Which value is obtained from the expression `"5" * "2"`?
"5" * "2"
Select your answer
Question 14/15
How do you convert a string `"123"` to a number in JavaScript?
Select your answer
Question 15/15
What is the value of `Boolean("false")` in JavaScript?
Boolean("false")
Select your answer
Your Results
You did not answer any questions correctly.
Your Answers
Question 1/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What is `typeof NaN` in JavaScript?
Available answers
Despite being "Not-a-Number", `NaN` is of type `number` in JavaScript.
Question 2/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What is `['a', 'b', 'c'].length` in JavaScript?
let arr = ['a', 'b', 'c'];
arr.length
Available answers
The length property of an array returns the number of elements in the array. `['a', 'b', 'c'].length` is `3`.
Question 3/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
How do you correctly check if a variable is a string in JavaScript?
Available answers
Use `typeof variable === 'string'` to check if a variable is of type string properly.
Question 4/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What result will `typeof undefined` produce?
typeof undefined
Available answers
In JavaScript, the `typeof` operator used on `undefined` returns `"undefined"`.
Question 5/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What will the expression `!!"text"` evaluate to in JavaScript?
!!"text"
Available answers
The double negation `!!` is used to convert any value to a boolean. Here, `"text"` is truthy, so `!!"text"` evaluates to `true`.
Question 6/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which of the following is a primitive data type in JavaScript?
Available answers
Strings, numbers, booleans, null, and undefined are the primitive data types in JavaScript. `String` is one of them.
Question 7/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What does the `===` operator compare?
Available answers
The `===` operator in JavaScript checks for both value and type equality.
Question 8/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
How can you express the floating-point number 12.5 using scientific notation in JavaScript?
Available answers
In JavaScript, `1.25e1` is equal to `12.5`, where `e1` represents 10 to the power of 1.
Question 9/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What value is returned by the expression `Number(undefined)` in JavaScript?
Number(undefined)
Available answers
The `Number` function converts the value to a number. If it can't be converted to a number, it will return `NaN`. `undefined` is converted to `NaN`.
Question 10/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What does `parseFloat("12.34abc")` return in JavaScript?
parseFloat("12.34abc")
Available answers
The `parseFloat` function converts a string to a floating-point number up to the first invalid character. Thus, `parseFloat("12.34abc")` returns `12.34`.
Question 11/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
If `let x;`, what is `x` initialized to?
let x;
Available answers
Variables declared using `let` without an initializer are initialized to `undefined`.
Question 12/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
How can you check if a number is not a number using a built-in JavaScript function?
Available answers
The `isNaN` function checks whether a value is `NaN`. If the result of the expression is `NaN`, `isNaN` returns `true`.
Question 13/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which value is obtained from the expression `"5" * "2"`?
"5" * "2"
Available answers
The `*` operator converts both strings to numbers in this case, so `"5" * "2"` equals `10`.
Question 14/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
How do you convert a string `"123"` to a number in JavaScript?
Available answers
You can convert a string to a number using the `Number` function, like so: `Number("123")`.
Question 15/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What is the value of `Boolean("false")` in JavaScript?
Boolean("false")
Available answers
When a string that is not empty (including the string "false") is converted to a boolean in JavaScript, it results in `true`. Non-empty strings are truthy values.