JavaScript Inheritance and Object Programming

Coding Tutorial, Chapter 6a

Code the implements() Method

© 21 July, 2013, Martin Rinehart


Leave an alert() in the Maskable() constructor to be sure you are calling it.


Add a Maskable() constructor (with a message for a QD test) and a capability_name property.

With that skeletal beginning, you are ready to write the implements() method. We've given ours an unused parameter, args to handle the needs of other capabilities.

The one statement in this instance method is a beautiful example of object programming. Its left-hand side uses a name expression to create a new property for the Box that requests it. The right-hand side uses the name expression to pick the constructor to call.

Feedback: Martin Rinehart at gmail dot com.

# # #