Level 1M2Lesson 2.5

beginner40 minby DevFox

Number pitfalls: NaN, floating point, and Math

Turn typed text into a number with Number() and catch NaN with Number.isNaN(), because NaN spreads and never equals itself. See why 1.1 + 2.2 prints 3.3000000000000003, round on purpose with Math.round, floor, ceil and toFixed, read TS2845, and make TaskKit say how full today’s list is.

  • Fundamentals
  • TypeScript
Number pitfalls: NaN, floating point, and Math. Read this lesson at .