Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

Here is the object prototype for the Hero and the implementation for creating hero objects populatin... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Java Programs A Back To Basics Approach

Authors: Stuart Reges, Marty Stepp

5th Edition

013547194X, 978-0135471944

More Books

Students also viewed these Programming questions