Quick Guide to using interfaces with JavaScript
Kameron Tanseli
194

If you console.log the Checkbox.prototype, you will get a function (makes sense) but if you check this function’s prototype, it is not

Input.prototype = Object.create(InputInterface);

Instead this function that is serving as the prototype has a own property of “prototype” referencing the return of Object.create(InputInterface);

Yet when you instantiate Checkbox, the returned Object reflects the correct prototype chain but you are unable to access any methods if they are not explicitly defined on Checkbox.prototype.render

Is this the whole idea behind it? I thought it was to have the required function be delegated if it is not defined down the prototype chain.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.