最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is there a Javascript equivalent to the Ruby syntax using underscores (e.g. 10_000 = 10000) to make larger integers human readab

programmeradmin1浏览0评论

In Ruby you may say:

n = 10_000 

or

n = 10000 

They are identical. I think you can also do something like this in Perl. This is a very nifty thing, to make large numbers more human readable.

My question is really two parts:

  1. Is there a Javascript equivalent? Because I would definitely use it.

  2. What do you call this underscore character, syntactically? I bet an experienced programmer can field this pretty easily, but I'm having a heck of a time trying to use the internet for a reverse dictionary. Such information I think would be useful to me in learning future languages. And it's absolutely driving me crazy, that I don't know how to describe it.

In Ruby you may say:

n = 10_000 

or

n = 10000 

They are identical. I think you can also do something like this in Perl. This is a very nifty thing, to make large numbers more human readable.

My question is really two parts:

  1. Is there a Javascript equivalent? Because I would definitely use it.

  2. What do you call this underscore character, syntactically? I bet an experienced programmer can field this pretty easily, but I'm having a heck of a time trying to use the internet for a reverse dictionary. Such information I think would be useful to me in learning future languages. And it's absolutely driving me crazy, that I don't know how to describe it.

Share Improve this question edited Oct 11, 2021 at 17:59 Tomerikoo 19.4k16 gold badges55 silver badges67 bronze badges asked Dec 3, 2013 at 11:37 sassas 1931 silver badge7 bronze badges 1
  • 1) No. 2) "Place separator", perhaps? – r3mainer Commented Dec 3, 2013 at 11:44
Add a ment  | 

2 Answers 2

Reset to default 9

Numeric Separators are now a feature of Javascript. (

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论