Number('123abc')
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 the value of `Number('123abc')` in JavaScript?
Number('123abc')
Select your answer
Question 2/15
How can you express the floating-point number 12.5 using scientific notation in JavaScript?
Select your answer
Question 3/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 4/15
Which value is obtained from the expression `"5" * "2"`?
"5" * "2"
Select your answer
Question 5/15
What does the `===` operator compare?
Select your answer
Question 6/15
Which statement will create an object from an empty object in JavaScript?
let obj = {};
Select your answer
Question 7/15
What is `['a', 'b', 'c'].length` in JavaScript?
let arr = ['a', 'b', 'c'];
arr.length
Select your answer
Question 8/15
What does the `typeof` operator return for an array in JavaScript?
let arr = [1, 2, 3];
typeof arr
Select your answer
Question 9/15
What will the expression `!!"text"` evaluate to in JavaScript?
!!"text"
Select your answer
Question 10/15
Which JavaScript type has no methods or properties of its own?
Select your answer
Question 11/15
What does `parseFloat("12.34abc")` return in JavaScript?
parseFloat("12.34abc")
Select your answer
Question 12/15
What is the result of `"5" - 1` in JavaScript?
"5" - 1
Select your answer
Question 13/15
What will `Boolean(" ")` return?
Boolean(" ")
Select your answer
Question 14/15
What will `"5" + 1` evaluate to in JavaScript?
"5" + 1
Select your answer
Question 15/15
What value is returned by the expression `Number(undefined)` in JavaScript?
Number(undefined)
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 the value of `Number('123abc')` in JavaScript?
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 2/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 3/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 4/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 5/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 6/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which statement will create an object from an empty object in JavaScript?
let obj = {};
Available answers
`Object.assign` can be used to copy all enumerable properties from one (or more) source objects to a target object. `Object.assign(obj)` will just return `obj` if it doesn't have another source object.
Question 7/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 8/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What does the `typeof` operator return for an array in JavaScript?
let arr = [1, 2, 3];
typeof arr
Available answers
In JavaScript, arrays are a type of object. Therefore, `typeof` always returns `"object"` for arrays.
Question 9/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 10/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which JavaScript type has no methods or properties of its own?
Available answers
`Undefined` is a primitive data type in JavaScript, which has no properties or methods.
Question 11/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 12/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 13/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 14/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What will `"5" + 1` evaluate to in JavaScript?
"5" + 1
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 15/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`.