+ 2
what is wrong here? PLEASE HELP I'M GOING TO LOOSE MY HEAD
function simo(name,age){ this.name= name; this.age= age; this.change= function(ugo){ this.name=name; } } var x= new simo("simo",18); x.change("lol"); alert(x.change);
1 Odpowiedź
+ 7
OMG DON'T LOSE YOUR HEAD!!!
HERE'S THE ANSWER:
function simo(name,age){
this.name= name;
this.age= age;
this.change= function(ugo){
this.name=name;
return this.name;
};
}
var x= new simo("simo",18);
alert(x.change("lol"));