I am calling a superclass method from a subclass. When called from a subclass, ‘this’ in the superclass method no longer refers to the superclass but to the subclass that called it. This creates problems with inheritance. Details as follows: In my project I use a class to construct objects from registered types. The types are registered from properties, or
Tag: prototypal-inheritance
Concatenative inheritance vs class inheritance in JavaScript
concatenative inheritance works like a composition to me when I look to it at the beginning, but people keep naming it as an inheritance. classes, however, use the prototype to create a prototype chain that connects objects together. the question now is, if both concatenative inheritance and class inheritance do the same thing which one to use? here is an
Why is extending native objects a bad practice?
Every JS opinion leader says that extending the native objects is a bad practice. But why? Do we get a perfomance hit? Do they fear that somebody does it “the wrong way”, and adds enumerable types to Object, practically destroying all loops on any object? Take TJ Holowaychuk’s should.js for example. He adds a simple getter to Object and everything
Node.js / Express.js – How to override/intercept res.render function?
I’m building a Node.js app with Connect/Express.js and I want to intercept the res.render(view, option) function to run some code before forwarding it on to the original render function. It looks like a contrived example, but it does fit in an overall framework I’m building. My knowledge of OOP and Prototypal inheritance on JavaScript is a bit weak. How would