实现说明
演示用的数据放在这几个模块级绑定中:budget、mask、secondsPerDay、rate。
使用要点
- 直接运行文件,输出会带上标签,比如
budget:、mask:、secondsPerDay:——输出的每一行都能指回产生它的那次调用。
常见问题
除了语言工具链还要下载什么吗?
除了这个语言的工具链,什么都不用再下载。 文件的状态由几个模块级绑定持有:budget、mask、secondsPerDay。
核心语句
const secondsPerDay = 86_400;
const budget = 1_250_000;
const mask = 0b1010_0001;
代码示例
// Underscores group digits inside numeric literals; they carry no value
const budget = 1_250_000;
const mask = 0b1010_0001;
const secondsPerDay = 86_400;
console.log('budget:', budget);
console.log('mask:', mask, mask.toString(2));
console.log('secondsPerDay:', secondsPerDay);
// Separators work inside decimal fractions too
const rate = 0.000_001;
console.log('rate:', rate);
// Allowed between digits on both sides of the decimal point
console.log('float parts:', 1_000.500_1);