英 [k?n?str?kt?(r)]? ?美 [k?n'str?kt?]??
n.構(gòu)造器
## 複數(shù):constructors
JavaScript 建構(gòu)函式屬性 語(yǔ)法
constructor屬性是什麼意思?
constructor存在於每一個(gè)function的prototype屬性中,constructor屬性是傳回對(duì)建立此物件的陣列函數(shù)的參考。
作用:傳回對(duì)建立此物件的陣列函數(shù)的參考。
語(yǔ)法:object.constructor
#說(shuō)明:constructor 屬性傳回對(duì)建立此物件的陣列函數(shù)的參考。
註解:無(wú)
JavaScript 建構(gòu)函式屬性 範(fàn)例
<html> <body> <script type="text/javascript"> var test=new Array(); if (test.constructor==Array) { document.write("This is an Array"); } if (test.constructor==Boolean) { document.write("This is a Boolean"); } if (test.constructor==Date) { document.write("This is a Date"); } if (test.constructor==String) { document.write("This is a String"); } </script> </body> </html>
執(zhí)行實(shí)例 ?
點(diǎn)擊 "執(zhí)行實(shí)例" 按鈕查看線上實(shí)例