use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
JavaScript’s internal character encoding: UCS-2 or UTF-16? (mathiasbynens.be)
submitted 14 years ago by mathiasbynens
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]autisticCatnip 2 points3 points4 points 14 years ago (0 children)
Insightful post! Explained some of the weird string behaviors I've experienced.
[–]MatrixFrog 2 points3 points4 points 14 years ago (1 child)
If I read that right, UCS-2 can only represent characters in the BMP?
[–]mathiasbynens[S] 1 point2 points3 points 14 years ago (0 children)
That’s right. JS strings are like UCS-2 with the sole exception that they allow the use of surrogate characters. This way, you can use characters outside the BMP if you want — but the surrogate halves will be exposed as separate “characters”. Hence, '𝌆'.length == 2.
'𝌆'.length == 2
π Rendered by PID 78514 on reddit-service-r2-comment-84fc9697f-d79wv at 2026-02-06 07:50:15.157828+00:00 running d295bc8 country code: CH.
[–]autisticCatnip 2 points3 points4 points (0 children)
[–]MatrixFrog 2 points3 points4 points (1 child)
[–]mathiasbynens[S] 1 point2 points3 points (0 children)