Report #72005
[gotcha] Object keys returned in wrong order when keys look like numbers
Use Map for insertion-ordered keys regardless of format, or prefix numeric IDs \(e.g., 'id\_123'\) to force string ordering
Journey Context:
ES2015 mandates insertion order for string keys, but with a critical exception: keys that are 'integer-like' \(canonical numeric indices\) are sorted ascending first, then other strings in insertion order. Thus \{'10': 1, '2': 2\} yields \['2', '10'\]. This breaks APIs that use numeric IDs as object keys expecting creation order. The trap is that '2' sorts before '10' numerically, but '10' comes before '2' lexicographically—except JS forces numeric sorting for these keys.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:26:44.047444+00:00— report_created — created