2 回答

TA貢獻(xiàn)1825條經(jīng)驗(yàn) 獲得超4個(gè)贊
/*這應(yīng)該是一個(gè)對(duì)象,下面是兩個(gè)方法吧?*/
function person(firstname,lastname,age,eyecolor) //這是代表人的一個(gè)函數(shù)
{
this.firstname=firstname; //當(dāng)前對(duì)象的firstname屬性等于 person函數(shù)的參數(shù)firstname的值
this.lastname=lastname; //當(dāng)前對(duì)象的lastname屬性等于 person函數(shù)的參數(shù)lastname的值
this.age=age; //當(dāng)前對(duì)象的age屬性等于 person函數(shù)的參數(shù)age的值
this.eyecolor=eyecolor; //當(dāng)前對(duì)象的eyecolor屬性等于 person函數(shù)的參數(shù)eyecolor的值
this.changeName=changeName; //當(dāng)前對(duì)象的changeNamer屬性等于 changeName函數(shù)
function changeName(name) //changeName函數(shù),這是代表改變名字的一個(gè)函數(shù)
{
this.lastname=name; //當(dāng)前對(duì)象的lastname屬性等于changeName函數(shù)的參數(shù)name的值
}
}
添加回答
舉報(bào)