Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: