描述
构造函数返回对创建实例原型的字符串函数的引用。
语法
它的语法如下 -
string.constructor
返回值
返回创建此对象实例的函数。
例请尝试以下示例。
<html>
<head>
<title>JavaScript String constructor Method</title>
</head>
<body>
<script type = "text/javascript">
var str = new String( "This is string" );
document.write("str.constructor is:" + str.constructor);
</script>
</body>
</html>
输出
str.constructor is: function String() { [native code] }