Skip to content
PhoenixAndMachine edited this page Apr 7, 2014 · 17 revisions

The idea of Object-oriented in Javascript is quite different from the traditional object-oriented languages, such as Java, Python. The most different aspects and also key features in Javascript are

  1. Function is the first-class variable.
  2. There is NO class, only object.
  3. The emulation of inheritance is implemented by prototype.

We will go through those features by illustrating how to define Interface, to fulfill Encapsulation and implement Inheritance in JS. The code in this page will not be illustrated step by step, more details represented as code can be checked in this repository. You will see why and how we end up at this.

2.1 Interfaces

2.2 Encapsulation

2.3 Inheritance

Clone this wiki locally