Question: Create an Object prototype called Hero which should have the following: Properties: name: a string to save his name dob: built-in Date object to save

  1. Create an Object prototype called Hero which should have the following: Properties: name: a string to save his name dob: built-in Date object to save his date of birth powerlevel: a number that save his level powerlist:[] // an array of strings to save his powers Methods: todisplay(): returns a string with the Hero information in the format as: 'name' born on 'dob', his level is 'powerlevel', and his list of powers are 'powerlist'. Create 2 hero objects based on the given prototype Hero. Give appropriate property values for all hero objects. Create an array named heroes and add all the hero objects into the array. Using the array, output the information of your heroes to the console.

Step by Step Solution

3.45 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the object prototype for the Hero and the implementation for creating hero objects populatin... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!