function a (){ this.testing = 'testing'; } function b (){ } b.prototype = new a(); console.log(b.testing);
The console shows undefined, not "testing." What am I doing wrong?
You have not made an instance of "b" yet.
var bInstance = new b(); console.log(bInstance.testing);
In other words, the properties of the prototype appear only on objects of type b , and not on the design function b() .
b
b()