
Why 0.1 Plus 0.2 Is Not 0.3 in JavaScript and How to Cope
0.1 plus 0.2 gives 0.30000000000000004 because binary floating point cannot store 0.1 exactly. See the cause, a safe comparison and how to handle money.
Tag
36 posts

0.1 plus 0.2 gives 0.30000000000000004 because binary floating point cannot store 0.1 exactly. See the cause, a safe comparison and how to handle money.

Compare Prisma and Drizzle in Node.js 26 by defining the same users and posts schema, running the same queries in each, and learn when raw SQL is better.

NaN is the number value for a failed numeric operation, and it is the one value not equal to itself. See how it arises, how to test for it and how it spreads.

JavaScript has seven primitive types, from undefined and null to bigint and symbol. See what each holds and why a primitive never changes.

Learn what a JavaScript promise is, how it moves from pending to fulfilled or rejected exactly once, and how then and catch build a chain of steps.

TC39 is the committee that evolves JavaScript, and a proposal moves through stages 0 to 4 before it joins a yearly edition. See the stages and how to follow.

A JavaScript engine parses and runs your code. V8, SpiderMonkey and JavaScriptCore follow one standard but differ in stack traces, flags and shipping dates.

ECMAScript is the language specification, and JavaScript is that language plus what a host adds, like the DOM or Node.js modules. See what belongs to which.

Learn what asynchronous programming means in JavaScript, why one thread needs it, and how callbacks, promises and async await let work finish later.

Learn JavaScript in order: twelve stages from a first script to a tested, deployable program, each with a worked exercise, its output and an exit check.

Build a production Dockerfile for Node.js: multi-stage builds, npm ci, a non-root user, a health check, signal handling and a .dockerignore.

Add and remove event listeners properly in JavaScript: matching references, the once and signal options, capture, passive, delegation and avoiding memory leaks.