Skip to content

Instantly share code, notes, and snippets.

@Kichrum
Kichrum / inherit.js
Last active August 29, 2015 14:04
Inheritance in JavaScript for EcmaScript 3
/**
* One more version of inheritance for ES3
* @author Kichrum
*/
var inherit = function(Parent) {
var Child = function(){ Parent.apply(this, arguments) }
// We can use
// Child.prototype = Object.create(Parent.prototype)
// here for ES5 instead of next 3 lines: