Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
JohnAdemoye.html
Oluwaseyi.html
README.md
chinkeki.html

README.md

Project JavaScript I1 Classes

Topics: Constructor Instance, Methods, Method Calls, Inheritance, Static Methods

Project Title: Traffic Light

  1. Create a html file with your name like john.html
  2. Add current code to that file:
<!DOCTYPE html>
<html>
  <body>
    <script>
      // your code here
    </script>
  </body>
</html>
  1. Create class named TrafficLight.

  2. Add color and address to it.

  3. Create an instance myTL and setcolor to red and address to Avenue 1

  4. Add a method named getColor to get color and call with console.log to show into console.

  5. Add a method name canGo that checks color and if it is green returns true, else false.

  6. Create class named VIPTrafficLight inherits from TrafficLight

  7. Add field SpecialEffects to this class.

  8. Create an instance named myVIP and set SpecialEffects to dotted.

  9. Add method getSpecialEffects() to return the effect.

  10. Add method setSpecialEffects() to set the effect. If it not dotted, solid or dashed do not set and log No valid Effect.

Want to get reviewed?

Send Pull Request. Check how to deliver your code: https://codingwithbasir.com/how-to-deliver-projects/

Need help?

Download Learn JavaScript eBook from https://codingwithbasir.com/learn-javascript

You can’t perform that action at this time.