gpt4 book ai didi

javascript - JS中的1000000到1M和1000到1K等等

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:51:58 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Is there a way round numbers into a friendly format? (e.g. $1.1k)
How to format numbers similar to Stack Overflow reputation format

我在 JS 中有很长的数字,我想让它们以更短、更容易理解的方式出现。

所以:

1,000,000 = 1M

1,200,000 = 1.2M

1,450 = 1.45K and so on...

关于如何在 JS 或 JQuery 中执行此操作的任何想法?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com