javascript对象的创建

方式一:

personObj=new Object()
personObj.firstname="John"
personObj.lastname="Adams"
personObj.age=35
personObj.eyecolor="black"

方式二:

function person(firstname,lastname,age,eyecolor)
{
this.firstname=firstname
this.lastname=lastname
this.age=age
this.eyecolor=eyecolor
}

myFather=new person("John","Adams",35,"black")

 

posted on 2012-05-28 23:32  leohxj  阅读(157)  评论(0编辑  收藏  举报

导航