3 ms·
> 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 misre
by cabalamat 3y ago
> 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.
- ygra 3y agoType 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.