[Javascript] Javascript numeric separators
JavaScript NUMERIC
2023-09-14 08:59:14 时间
Big or non decimal numbers are sometimes hard to read inside code. Numeric separators are now part of the javascript specification and allow us to make numbers in our code more readable for humans. In this lesson we will learn how to use numeric separators and the limitations of usage.
const bigNumber = 1999999999999; console.log(bigNumber); const bigReadableumber = 1_999_999_999_999; console.log(bigReadableumber); console.log(275.789897); console.log(275.789_897); console.log(0b0100_1010_1110_1010); const myBigInt = 1_234_567_890_123_456_789_012n; console.log(myBigInt.toString()); // const badReadable = 1111__1111; bad // const badReadable2 = 11111_; bad // const binary = 0b_1111; bad
相关文章
- 第九十八节,JavaScript语法、关键保留字及变量
- 第九十七节,使用JavaScript
- JavaScript经典代码【二】【javascript判断用户点了鼠标左键还是右键】
- [Javascript] Avoid Accidental Returns of New State by using the void Keyword
- [Javascript] Multiply Two Arrays over a Function in JavaScript
- [Javascript] Convert a Callback-Based JavaScript Function to a Promise-Based One
- [Javascript] Understanding the .constructor property on JavaScript Objects
- [Javascript] Redirect the browser using JavaScript
- [Javascript] How to use JavaScript's String.replace
- JavaScript 逗号表达式
- Web前端----Javascript模块化
- DOM文档和Javascript的IE和Firefox兼容性
- [Javascript] Wait for Multiple JavaScript Promises to Settle with Promise.allSettled()
- [Javascript] Hide Properties from Showing Up in "for ... in" Loops in JavaScript
- [Javascript] Conditionally spread entries to a JavaScript object
- [Javascript] Iterate Over Items with JavaScript's for-of Loop
- [Javascript] Understand Function Composition By Building Compose and ComposeAll Utility Functions
- [Javascript] Identify and Deal with NaN in JavaScript
- [Javascript] An Introduction to JSPM (JavaScript Package Manager)
- Angular Component代码和编译后生成的JavaScript代码
- 使用浏览器自带的javascript调试器
- 从零开始学_JavaScript_系列(22)——dojo(9)(表单、JsonRest的post方法,widget的使用思路)
- javascript中的高阶函数, 和 类定义Function, 和apply的使用
- JavaScript基础语法整理
- web前端框架Javascript开发基础之JavaScript作用域