Exercise:
Add the following property and value to the person object:
country: USA
Hint
Hint: Do not forget comma.
Edit This Code:
See Result »
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var person = {firstName:"John", lastName:"Doe"}; document.getElementById("demo").innerHTML = person.country; </script> </body> </html>
Result:
Show Answer
Correct Code:
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var person = {firstName:"John", lastName:"Doe", country: "USA"}; document.getElementById("demo").innerHTML = person.country; </script> </body> </html>
Correct Result:
Hide Answer
Privacy Policy