JavaScript sort() UTF-16 Moment
The sort() method sorts the elements of an array in place and... ...then comparing their sequences of UTF-16 code units values. > [6, -2, -7, 9].sort() < ▸ (4) [-2, -7, 6, 9]
A four-panel meme uses Mr. Incredible’s increasingly unsettling expressions to explain JavaScript’s sort() method. The punchline is that numbers are sorted lexicographically by UTF-16 code units by default, so the result is based on string ordering rather than numerical value. EN: A four-panel meme uses Mr. Incredible’s increasingly unsettling expressions to explain JavaScript’s sort() method. The punchline is that numbers are sorted lexicographically by UTF-16 code units by default, so the result is based on string ordering rather than numerical value.
animated man’s face / лицо мультяшного мужчиныblond hair / светлые волосыblue eyes / голубые глазаgray background / серый фонblack-and-white portrait / черно-белый портретcode screenshot / скриншот кодаdark text panels / тёмные панели с текстомarray of numbers / массив чиселbrowser-style code output / вывод кода в стиле браузераwhite border / белая рамкаfour-panel layout / компоновка из четырёх панелей
- @gentoomemes / 3201 2023-03-17
- Template
- Mr. Incredible Becoming Uncanny
- Type
- image
- Size
- 780×724 · 40.0 KiB
- Mood
- absurd, unsettling
- Language
- en
- Added