> TIL(JavaScript): A BigInt is created by appending n to the end of an integer literal — 17n
Am I the only person who thinks that looks ugly? I initially misread it as a typo for 17*n.
In Python it would just be 17. Python knows when an int is a bigint, because it is big.
Type suffixes on literals are fairly typical in languages using C-style syntax, so for JS I'd expect it to make more sense that way than doing it like Python does. Apart from the usual problems you'd get when your numbers suddenly behave very different than before. That has to be an opt-in syntax change.
> return d % 2n == 1n;
TIL(JavaScript): A BigInt is created by appending n to the end of an integer literal — 17n — or by calling the function BigInt().
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...