<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>对象上的特殊属性</title> </head> <body> <script type="text/javascript"> function Hero(name) { this.name = name; this.occupation = 'Ninja'; this.whoAreYou = function() { return "I'm " + this.name + " and I'm a " + this.occupation; } } var h1 = new Hero('Michelangelo'); alert(h1.constructor);//返回一个函数 var obj = {};//var obj = new Object(); alert(obj.constructor); </script> </body> </html>
原文:http://blog.csdn.net/zhengwei223/article/details/41757639