Operators & Type Conversion
Difficulty: easy
Overview
JavaScript performs implicit type coercion with == (loose equality) but not with === (strict equality). Arithmetic operators follow standard precedence. Unary + converts a value to a number; String() or template literals convert to string. parseInt / parseFloat parse strings to numbers. NaN (Not-a-Number) is the result of failed numeric conversion and is the only value not equal to itself.
Practice Linked Questions
Q1. What is the output of the following code? ```js console.log(0.1 + 0.2 === 0.3); ```
Select one answer before revealing.
Q2. What is the difference between `==` and `===` in JavaScript?
Select one answer before revealing.
Q3. What is the result of `"5" - 2` in JavaScript?
Select one answer before revealing.
Q4. What does `parseInt("3.9")` return?
Select one answer before revealing.
Q5. What is the output? ```js console.log(NaN === NaN); ```
Select one answer before revealing.
Q6. What is the output? ```js console.log(1 + "2" + 3); ```
Select one answer before revealing.
Q7. What does `console.log(Boolean(""))` output?
Select one answer before revealing.
Q8. What is the output? ```js console.log(2 ** 3); ```
Select one answer before revealing.