Tag Archives: oop

JS OOP Cheatsheet

Assume you have a JavaScript class, Car. You can create an instance of it:

new Car()

It’s really just a constructor function:

function Car() {}

Then:

  • Car.prototype.method is an instance method.

  • this.var inside Car() constructor or an instance method is an instance variable.

  • Car.var is a static (class-level) variable.

  • Car.method is a static method.