"5" + 1
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
How do you correctly check if a variable is a string in JavaScript?
Select your answer
Question 2/15
What will `"5" + 1` evaluate to in JavaScript?
"5" + 1
Select your answer
Question 3/15
In JavaScript, which type of loop will run at least once no matter what?
Select your answer
Question 4/15
What does the `===` operator compare?
Select your answer
Question 5/15
What is the value of `Boolean("false")` in JavaScript?
Boolean("false")
Select your answer
Question 6/15
What value is returned by the expression `Number(undefined)` in JavaScript?
Number(undefined)
Select your answer
Question 7/15
What does `parseInt("10.5")` return in JavaScript?
parseInt("10.5")
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 is the result of `"5" - 1` in JavaScript?
"5" - 1
Select your answer
Question 10/15
What will `Boolean(" ")` return?
Boolean(" ")
Select your answer
Question 11/15
Which JavaScript function would you use to combine variable `let a = 'Hello'; let b = 'World';` into a single output 'Hello World'?
let a = 'Hello';
let b = 'World';
Select your answer
Question 12/15
What is the value of `Number('123abc')` in JavaScript?
Number('123abc')
Select your answer
Question 13/15
How do you convert a string `"123"` to a number in JavaScript?
Select your answer
Question 14/15
How can you check if a number is not a number using a built-in JavaScript function?
Select your answer
Question 15/15
Which of the following is NOT a falsy value in JavaScript?
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
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 2/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What will `"5" + 1` evaluate to in JavaScript?
Available answers
In JavaScript, when using the + operator with a string and a number, the number is converted to a string, and string concatenation occurs. Thus, `"5" + 1` evaluates to `"51"`.
Question 3/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
In JavaScript, which type of loop will run at least once no matter what?
Available answers
A `do...while` loop will execute the block of code at least once before checking the condition.
Question 4/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 5/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.
Question 6/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 7/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What does `parseInt("10.5")` return in JavaScript?
parseInt("10.5")
Available answers
The `parseInt` function converts a string to an integer. It parses up to the first invalid character for an integer, so `parseInt("10.5")` returns `10`.
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 is the result of `"5" - 1` in JavaScript?
"5" - 1
Available answers
In JavaScript, the `-` operator converts operands to numbers if they're not, so `"5" - 1` evaluates to `4`.
Question 10/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What will `Boolean(" ")` return?
Boolean(" ")
Available answers
The `Boolean` conversion of any non-empty string will return `true`, including a space character.
Question 11/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which JavaScript function would you use to combine variable `let a = 'Hello'; let b = 'World';` into a single output 'Hello World'?
let a = 'Hello';
let b = 'World';
Available answers
In JavaScript, you use `a.concat(' ', b)` to combine two strings.
Question 12/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What is the value of `Number('123abc')` in JavaScript?
Number('123abc')
Available answers
The `Number` function returns `NaN` when a string cannot be converted to a number. Since `'123abc'` is not a valid number, the result is `NaN`.
Question 13/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 14/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 15/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which of the following is NOT a falsy value in JavaScript?
Available answers
In JavaScript, the string "false" is not falsy. Falsy values include `false`, `0`, `NaN`, `""` (empty string), `null`, and `undefined`.