BitlystBitlyst
PostsSeriesTopicsAbout

Bitlyst

Short, diagram-first posts on JavaScript, React & Next.js. Follow via RSS or the newsletter.

© 2026 Mohsen Fallahnejad

PostsSeriesTopicsLinksAboutRSSGitHubX
← All series

Series

JavaScript Plot Twists

Real bugs caused by JavaScript doing exactly what the spec says — and nothing you expected.

Your guide: Twisty. Has read the spec. Is still surprised every time.

5 of 8 parts published · 24 min total

0/5 read
Start reading: Part 1 →
  1. 1The Leaderboard That Ranked 9 Points Above 100Why JavaScript's sort() compares numbers as strings, why a 'lazy' comparator works in Safari but breaks in Chrome, and the one-line fix.
    Oct 31, 20265 min read3
  2. 2You Selected Rows 3, 8, 12, 15 and 20. JavaScript Checked 3, 1 and 8.Why ['1', '7', '11'].map(parseInt) returns [1, NaN, 3]: map passes the index as parseInt's radix. Plus the Number('') trap hiding in the obvious fix.
    Nov 1, 20264 min read2
  3. 3The Settings Object That Came Back undefinedHow automatic semicolon insertion (ASI) turns `return` followed by a newline into `return;`, and the lines where JavaScript refuses to add a semicolon at all.
    Nov 2, 20265 min read
  4. 4The $4.35 Item That Was Charged $4.34Why 0.1 + 0.2 !== 0.3 in JavaScript, how floating-point math drops a cent when converting dollars to cents, and why money should be stored as integers.
    Nov 3, 20265 min read
  5. 5The Leaderboard Arrived Sorted. JavaScript Re-sorted It by User ID.Why JavaScript object key order puts integer-like keys first in ascending order, how that silently reorders JSON from your API, and when to use an array or Map.
    Nov 3, 20265 min read
  6. 6The birthday that showed up a day earlyComing soon
  7. 7The forEach that didn't wait for awaitComing soon
  8. 8The regex that matched every other timeComing soon

Get new posts in your inbox

No spam. Unsubscribe any time.