What does `console.log(0.1 + 0.2 === 0.3)` output?

JavaScript Associate Easy

JavaScript Associate — Easy

What does `console.log(0.1 + 0.2 === 0.3)` output?

Key points

  • JavaScript's floating-point arithmetic can lead to small precision errors.
  • Comparing floating-point numbers for equality can be tricky.
  • Always be cautious when working with decimal numbers in JavaScript.

Ready to go further?

Related questions