📜  JavaScript Number 构造函数属性

📅  最后修改于: 2022-05-13 01:56:55.963000             🧑  作者: Mango

JavaScript Number 构造函数属性

下面是 Number 构造函数属性的示例。

  • 例子:
html

 
 

    

        Welcome to GeeksforGeeks     

             

        Click the button to see number         constructor property.     

                          

                      


html


html


  • 输出:
    • 在点击按钮之前:

  • 点击按钮后:

Javascript 中的Number 构造函数属性用于返回对象的数字构造函数。此属性返回的函数只是对该函数的引用,而不是包含函数名称的数字。 JavaScript 数字构造函数、字符串构造函数和布尔构造函数分别返回函数 Number() { [native code] }、 函数 String() { [native code] } 和函数 Boolean() { [native code] }。
句法:

number.constructor

返回值:此函数返回 Number() { [本机代码]。
上述属性的更多示例代码如下:
方案一:

html


输出:

function Number() { [native code] }

方案一:

html


输出:

function Number() { [native code] }

支持的浏览器:

  • 谷歌浏览器 6.0 及以上
  • Internet Explorer 9.0 及更高版本
  • Mozilla 4.0 及更高版本
  • Opera 11.1 及更高版本
  • Safari 5.0 及以上