If you're seeing this message, it means we're having trouble loading external resources for Khan Academy.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Object-Oriented Design

1 article
3 challenges
3 talkthroughs
How to use object-oriented concepts in JavaScript to make more re-usable code.

Object Types

Pamela explains the first part of object-oriented programming: creating object types and instances of those object types.

Challenge: Double Rainbow

Create a Rainbow object type that can describe the many rainbows in the world.

Object Methods

Pamela shows how to attach methods to object types, that you can call on any instance of that object.

Challenge: SmileyFace

Create a SmileyFace object with its own methods.

Object Inheritance

Pamela shows how objects can inherit and re-use the code of other object types.

Challenge: Flower Grower

Create a Flower object type that Sunflower and Tulip can inherit from.