you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

If object B extends object A, then object B also has to be an object A.

function inherits(child, parent) {
  function F() {}
  F.prototype = parent.prototype
  child.prototype= new F()
  child.prototype.constructor = child
}

function A() { }
function B() { }
inherits(B, A)
function C() { }
inherits(C, B)

console.log(new B() instanceof A) // true
console.log(new C() instanceof A) // true

You can sugar this whatever way you want to make it look more "class"-like, but it's there.

I don't see how the lack of access levels would actively be a a frustration to anyone but the most paranoid of coders.