constructor 屬性返回對(duì)創(chuàng)建此對(duì)象的 Boolean 函數(shù)的引用。
object.constructor
在本例中,我們將展示如何使用 constructor 屬性:
<script type="text/javascript"> var test=new Boolean(); 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>
輸出:
This is a Boolean
如對(duì)本文有疑問(wèn),請(qǐng)?zhí)峤坏浇涣髡搲瑥V大熱心網(wǎng)友會(huì)為你解答??! 點(diǎn)擊進(jìn)入論壇
Powered by 365建站網(wǎng) RSS地圖 HTML地圖
copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號(hào)