Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewstokeley/a39a8e309bb86ff9d4eeb0f5a646fb55 to your computer and use it in GitHub Desktop.
Save matthewstokeley/a39a8e309bb86ff9d4eeb0f5a646fb55 to your computer and use it in GitHub Desktop.
object-oriented-prototypal-javascript-in-5-seconds

Prototypal Javascript

// this is like a constructor
const Oopj = function() {}
// inherits or implements a built-in prototype object
console.log(Oopj.prototype);

// can be assigned methods
Oopj.prototype.methodName = function() {}
// can be instantiated like a class
const oopj = new Oopj();
// methods are called with dot notation
oopj.methodName();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment