JavaScript String – constructor 属性 描述 一个构造函数返回一个引用,指向创建该实例原型的字符串函数。 语法 它的语法如下 − string.constructorHTMLCopy 返回值 返回创建此对象实例的函数。 例子 尝试下面的例子。 <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> HTMLCopy 输出 str.constructor is: function String() { [native code] } HTMLCopy