What is the output of: console.log(0.1 + 0.2 == 0.3, 0.1 + 0.2 === 0.3)?

JavaScript Developer Medium

JavaScript Developer — Medium

What is the output of: console.log(0.1 + 0.2 == 0.3, 0.1 + 0.2 === 0.3)?

Key points

  • JavaScript's floating-point arithmetic can lead to unexpected results.
  • The == operator performs type coercion, while === does not.
  • In this case, the addition of 0.1 and 0.2 does not exactly equal 0.3.

Ready to go further?

Related questions