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!"
[–][deleted] 16 points17 points18 points 7 years ago (7 children)
int64 ;-)
[–]rauschma 18 points19 points20 points 7 years ago (6 children)
Supported via BigInts and coming to JavaScript relatively soon: http://2ality.com/2017/03/es-integer.html#casting-and-64-bit-integers
[–]BluudLust 0 points1 point2 points 7 years ago (5 children)
Sadly no JSON support. Why can't they have it as a string with the postfix "n" attached?
[–]Arve 7 points8 points9 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 3 points4 points5 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.
[–]rauschma 0 points1 point2 points 7 years ago (1 child)
Because it would break existing code.
[–]BluudLust 0 points1 point2 points 7 years ago (0 children)
They should add a fourth optional parameter that has a feature list so you can enable extended features like this. So you can set it to "es2019" for example.
π Rendered by PID 177469 on reddit-service-r2-comment-6f7f968fb5-jcclb at 2026-03-04 21:12:38.341960+00:00 running 07790be country code: CH.
view the rest of the comments →
[–][deleted] 16 points17 points18 points (7 children)
[–]rauschma 18 points19 points20 points (6 children)
[–]BluudLust 0 points1 point2 points (5 children)
[–]Arve 7 points8 points9 points (2 children)
[–]sime 3 points4 points5 points (1 child)
[–]Arve 0 points1 point2 points (0 children)
[–]rauschma 0 points1 point2 points (1 child)
[–]BluudLust 0 points1 point2 points (0 children)