Number()
构造函数创建一个 Number
对象。
语法
new Number(value)
参数
value
- 创建的
Number
对象的数值。
例子
创建 Number 对象
const a = new Number('123'); // a === 123 is false
const b = Number('123'); // b === 123 is true
a instanceof Number; // is true
b instanceof Number; // is false
规范
浏览器兼容性
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.