A

Admin • 833K Points
Coach

Q. What does the following code output?

Code:
console.log(0.1 + 0.2 === 0.3);
  • (A) true
  • (B) false
  • (C) undefined
  • (D) NaN
  • Correct Answer - Option(B)
  • Views: 24
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

Due to floating-point precision issues in JavaScript, `0.1 + 0.2` does not exactly equal `0.3`, so the comparison returns `false`.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.