0

Please help me i dont know what im doing wrong

html> body> script> function person(name, age) { this.name = name; this.age = age; this.changeName = function (name) { this.name = name; } } var p = new person("David", 21); p.changeName("John"); //Now p.name equals to "John" /script> /body> /html>

25th Mar 2019, 7:05 PM
Gregorio Faerman
Gregorio Faerman - avatar
5 Réponses
+ 2
You're using a wrong syntax of html, why? Because instead of <html> you have html> that's the only mistake you have, for html body and script add a < for each markup
25th Mar 2019, 7:08 PM
Juan David Padilla Diaz
Juan David Padilla Diaz - avatar
+ 1
://hey Gregorio Faerman problem was you were writhing html code in javascript editor, copy html to html and scripts to scripts https://code.sololearn.com/WHhqk7W4rI60/?ref=app
25th Mar 2019, 7:37 PM
Sudarshan Rai
Sudarshan Rai - avatar
0
@Juan David Padilla Diaz I put it and its says "Uncaught SyntaxError: Unexpected token < Line: 1"
25th Mar 2019, 7:26 PM
Gregorio Faerman
Gregorio Faerman - avatar
0
Show me your code on playground
25th Mar 2019, 7:27 PM
Juan David Padilla Diaz
Juan David Padilla Diaz - avatar
0
done
25th Mar 2019, 7:33 PM
Gregorio Faerman
Gregorio Faerman - avatar