Lyrics

注意两个的区别I,尤其第一个,自己总是理解不了

1.

function person(firstname,lastname,age,eyecolor)

{

this.firstname=firstname;

this.lastname=lastname;

this.age=age;

this.eyecolor=eyecolor;

 

this.changeName=changeName;

function changeName(name)

{

this.lastname=name;

}

}



2.


function Car(sColor,iDoors,iMpg) {

  this.color = sColor;

  this.doors = iDoors;

  this.mpg = iMpg;

  this.showColor = function() {

    document.write(this.color);

  };

}


评论