JavaScript Sort Betrayal
Welcome to Node.js v16.20.0. Type ".help" for more information. > [1, 2, 10].sort() [ 1, 10, 2 ] >
A Node.js terminal shows the array [1, 2, 10] being sorted into [1, 10, 2]. The joke is that JavaScript's default sort compares values as strings, producing an unexpected result that surprises or frustrates programmers. It is commonly sent as a reaction to confusing programming bugs or JavaScript quirks.
- @gentoomemes / 4661 2023-05-21
- Template
- JavaScript console screenshot
- Type
- image
- Size
- 562×184 · 10.3 KiB
- Mood
- алгоритмичный юмор
- Language
- en
- Added