Category Archives: JavaScript

Inheritance approaches in JavaScript

We are going to develop the following case: Two classes: Base: parent class with the same structure. State: color (string type, private scope). Behavior: sayColor, returning color. Child: subclass from Base with: State: name (string type, private scope). Behavior: sayName, returning name. Instanciating of child object. If we use a “classical” OOP language like Java:… Read More »

Defining Classes and Objects in JavaScript

We’d like to create one new object “Car” in JavaScript with the same features: property / state: color method: showColor One way to create your own objects in JavaScript instancing from JavaScript Object:

But so that we have a trouble: we can’t reuse the same structure (states & methods) to generate new oCar objects How… Read More »