- #58
- #57
- #56
- #55
- #54
- #53
- #52
- #51
- #50
- #49
- #48
- #47
- #46
- #45
- #44
- #43
- #42
- #41
- #40
- #39
- #38
- #37
- #36
- #35
- #34
- #33
- #32
- #31
- #30
- #29
- #28
- #27
為什麼會有 _ 在數字當中?
其實是 JavaScript 在 ECMAScript 2021 中新增的一個特性,叫做「Numeric Separators」,可以讓我們在數字之間加入
_
來增加可讀性。const readableMiliion = 1_000_000;const regularMiliion = 1000000;const decimal = 1_000_000.220_720;const binary = 0b01010110_00111000;const hexa = 0x40_76_38_6a_73;從 Node 12.5.0、Chrome 75、Firefox 70、Safari 13.1 都已經支援了,可以放心使用。延伸搜尋了一下,發現蠻多程式語言皆有支持這樣的特性。
- #26
- #25
- #24
- #23
- #22
- #21
- #20
- #19
- #18
- #17
- #16
- #15
- #14
- #13
- #12
- #11
- #10
- #9
- #8
- #7
- #6
- #5
- #4
- #3
- #2
- #1