+ 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);

21st Jan 2017, 5:06 PM
Simone Gramegna
Simone Gramegna - avatar
1 Réponse
+ 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"));
21st Jan 2017, 5:09 PM
Valen.H. ~
Valen.H. ~ - avatar