首页 > 代码库 > javascript 理解对象

javascript 理解对象

ECMA-262 把对象定义为:无序属性的集合,其属性可以包含基本值、对象或者函数;

 

var Person = {      name:"wsc",      age :"25",      job :"software engineer",       sayname : function(){          alert(this.name)      } } var person = new Object(); person.name="wsc"; person.age = "26"; person.job = "software engineer"; person.sayname=function(){       alert(this.name);}

 

ECMA-262 第5版中定义对象的两种属性:数据属性和访问属性;

javascript 理解对象