Make a base SuperHero
class. Give it some properties, and actions (methods) that change those properties.
Make at least one of the methods interact with another SuperHero
, such as attack(otherHero)
or giveMotivationalSpeech(otherHero)
. Be creative!
Add tests for your SuperHero
class.
- Write tests for what it should do in tests.js.
- Open index.html to run the tests.
Make a base class with two subclasses that have two or special properties and actions, with tests covering all of the functionality, using test-driven development (TDD).
- Write a test for what it should do in tests.js.
- Open index.html to run the tests.
- Define the class in super_hero.js, and make the tests pass.
- Repeat from step 1.
As an example, you could make a SuperHuman
base class with SuperHero
and SuperVillain
subclasses. Maybe SuperHero
es have the ability to have a shield, and therefore attack(hero)
will have different behavior than attack(villain)
.