function Person(name, sex, age) { this.name = name; this.sex = sex; this.age = age; }
属性名
|
说明
|
__defineGetter__ | 用于追加定义getter方法,继承自Object |
__defineSetter__
|
用于追加定义setter方法,
继承自Object
|
__lookupGetter__
|
获取getter属性,ES5 getOwnPropertyDescriptor |
__lookupSetter__
|
获取setter属性,
getPrototypeOf
|
apply、call、bind
|
调用当前方法,以另外的对象替代当前对象 |
aguments
|
调用该函数时传入的参数
|
caller |
获取调用当前函数的函数
|
length
|
获取为一个函数定义的参数数目
|
name
|
函数名称
|
propertyIsEnumberabel
|
属性是否可枚举
|
prototype
|
输出格式是构造函数名 原型
|
toLocaleString
|
转化成本地化字符串
|
toString
|
转化成字符串
|
valueOf
|
转化成原始值(string number null undefined boolean)
|
__proto__
|
原型链:私有属性(FF暴露为共有属性):实例化对象拥有该属性 |
constructor
|
构造函数
|
//建立Person的原型 Person.prototype = { construtor: Person, sayHello: function() { alert('Hello'); } } //实例化,能够实例化多个对象 var danny = new Person('Danny', 'male', 18); var jenny = new Person('Jenny', 'female', 24); Person.prototype.isPrototypeOf(danny) //true,说明danny继承了Person的属性 danny .constructor //Person Person.constructor //Function var tom = {}; danny.sayHello.apply(tom); //tom也能使用danny的sayHello danny.__proto__ == Person.prototype //__proto__ 能够理解为对象的父对象