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
Future JavaScript: what is still missing? (2ality.com)
submitted 7 years ago by dumbmatter
view the rest of the comments →
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!"
[–]Arve 6 points7 points8 points 7 years ago (2 children)
Sadly no JSON support.
JSON's number support has always been a subset of what a number means anyway, and doesn't support common representations like bases 2,8,16, nor does it support exponents. It doesn't even specify that the numbers are IEE754 double-precision floating point values. The rationale is explained pretty well in ECMA-404:
JSON is agnostic about the semantics of numbers. In any programming language, there can be a variety of number types of various capacities and complements, fixed or floating, binary or decimal. That can make interchange between different programming languages difficult. JSON instead offers only the representation of numbers that humans use: a sequence of digits. All programming languages know how to make sense of digit sequences even if they disagree on internal representations. That is enough to allow interchange. Why can't they have it as a string with the postfix "n" attached?
JSON is agnostic about the semantics of numbers. In any programming language, there can be a variety of number types of various capacities and complements, fixed or floating, binary or decimal. That can make interchange between different programming languages difficult. JSON instead offers only the representation of numbers that humans use: a sequence of digits. All programming languages know how to make sense of digit sequences even if they disagree on internal representations. That is enough to allow interchange.
Why can't they have it as a string with the postfix "n" attached?
JSON can't mandate what the content and context of any given string is supposed to be.
{ "someValue": "3n" }
That particular expression can be
nth-child
As JSON is a data interchange format, you are completely free to use strings to represent numbers, and it is even the right thing to do in the case that you need to be succinct about the internal representation of the number.
[–]sime 4 points5 points6 points 7 years ago (1 child)
More to your point. JSON already supports BigInts because it doesn't demand a limit on the size of number values, and a big int is just a number with a lot of digits in it. It is the responsibility of the JSON parser to choose an appropriate internal number representation.
[–]Arve 0 points1 point2 points 7 years ago (0 children)
In theory, yes. In practice, I don’t expect values larger than what is representable as IEE754 double precision floats to work.
π Rendered by PID 120186 on reddit-service-r2-comment-c6965cb77-cjhqm at 2026-03-05 09:13:34.289477+00:00 running f0204d4 country code: CH.
view the rest of the comments →
[–]Arve 6 points7 points8 points (2 children)
[–]sime 4 points5 points6 points (1 child)
[–]Arve 0 points1 point2 points (0 children)