Question regarding the Class Statics in JS
Creating Class Statics
Class-wide data (data that applies to every instance) can be attached as a property of theconstructor, as Listing 1-10 shows.
Dog.diet = "carnivore"; // not prototype alert(lassie.diet); // undefined Dog.prototype.diet = "carnivore"; alert(lassie.diet); // carnivore
I don't get what he meant by "data that applies to every instance". Because when I add diet property to Dog, how the instances of Dog will get the access to the property?
Submitted August 13, 2017 at 01:14AM by arup_r
via reddit http://ift.tt/2wSXwsi