In this example, We are creating JavaScript Object with multiple property and printing their property value in paragraph tag as: "person.firstName + " is " + person.age + " years old." will print "Michael is 30 years old. See the code snippet:
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <p>Creating Object.</p> <p id="sample"></p> <script> var person = {firstName:"Michael", lastName:"Voughan", age:30, eyeColor:"blue"}; document.getElementById("sample").innerHTML = person.firstName + " is " + person.age + " years old."; </script> </body> </html>