What will be the result of the following JavaScript expression ?…
2023
What will be the result of the following JavaScript expression ?
console.log(0.1 + 0.2 === 0.3);
Answer: A. false — In JavaScript, decimal fractions such as 0.1 and 0.2 are stored in binary floating-point form. Their sum is not represented exactly as 0.3, so the strict…
- A.
false
- B.
undefined
- C.
true
- D.
NaN
Attempted by 55 students.
Show answer & explanation
Correct answer: A
In JavaScript, decimal fractions such as 0.1 and 0.2 are stored in binary floating-point form. Their sum is not represented exactly as 0.3, so the strict comparison returns false.
Loading lesson…