Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

JavaScript Gotchas: Default Array.sort, == Coercion, parseInt in map, Date Parsing and var in Loops

Self-Hosting & Infra beginner 6 min read $0.01 Updated 2026-10-20

Node 22 outputs: [10,9,100].sort(), numeric compare function, loose equality results, Number versus parseInt versus parseFloat, Date parsing of 2026-10-20 as UTC, 2026-02-30 becoming March 1, includes versus indexOf for NaN, and let versus var closures.

Run the classic JavaScript surprises and learn their fixes: sort() comparing text, ["1","2","3"].map(parseInt), invalid dates rolling over, date-only strings parsed as UTC, NaN checks and closures in var loops.

Read the full guide

The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.

Open in the Knowledge Base Agent API →