Skip to content

advanced-js/oop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Object Oriented Programming exercise

V1

Make a base SuperHero class. Give it some properties, and actions (methods) that change those properties.

V2

Make at least one of the methods interact with another SuperHero, such as attack(otherHero) or giveMotivationalSpeech(otherHero). Be creative!

V3

Add tests for your SuperHero class.

  1. Write tests for what it should do in tests.js.
  2. Open index.html to run the tests.

Resources

V4

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).

  1. Write a test for what it should do in tests.js.
  2. Open index.html to run the tests.
  3. Define the class in super_hero.js, and make the tests pass.
  4. Repeat from step 1.

As an example, you could make a SuperHuman base class with SuperHero and SuperVillain subclasses. Maybe SuperHeroes have the ability to have a shield, and therefore attack(hero) will have different behavior than attack(villain).

Resources