Code:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Object-oriented JavaScript example</title> </head> <body> <script> const person={ name:['Syed Ahmed','Zaki'], age:27, gender:'male', interests: ['music','skiing'], bio: function(){ alert(this.name[0]+' '+this.name[1]+'is'+this.age+' years old. He likes '+this.interests[0]+this.interests[1]); }, greeting: function(){ alert("Hi! I\'m "+this.name[0]+ '.'); } };//this is a object </script> </body> <script> </script> </html>