Peak JavaScript Moment
peak javascript moment: if you call setInterval with a timeout greater than INT_MAX, instead of throwing an error (the same thing to do), setInterval will silently execute your callback **every millisecond** setInterval( () => console.log("Wait a long time!"), Number.MAX_SAFE_INTEGER + 1 // 2,147,483,648 milliseconds ~= 25 days ) Wait a long time!
A screenshot of a social media post jokes about JavaScript’s setInterval behavior when given a timeout larger than INT_MAX. Instead of waiting roughly 25 days, the callback runs every millisecond, making “Wait a long time!” absurdly misleading. It is shared as a programming reaction to bizarre bugs and unintuitive JavaScript behavior. EN: A screenshot of a social media post jokes about JavaScript’s setInterval behavior when given a timeout larger than INT_MAX. Instead of waiting roughly 25 days, the callback runs every millisecond, making “Wait a long time!” absurdly misleading. It is shared as a programming reaction to bizarre bugs and unintuitive JavaScript behavior.
- @gentoomemes / 19826 2026-01-08
- Type
- image
- Size
- 755×800 · 83.2 KiB
- Mood
- саркастичный, абсурдный
- Language
- en
- Added