|
|
|
|
|
by jashkenas
5469 days ago
|
|
Go for it. In a nutshell: An object is a unit of code and data that can be treated as a distinct entity. Classes and prototypes are both way to make objects. With a prototype, you start with an actual object as an example, and make more objects just like it. With a class, you start with the abstract set of properties that describe a type of object, and make more objects from that blueprint. Think of it as the Platonic ideal of a thing (the class), versus the canonical example of a thing (the prototype). To get specific: The idea of Bicycle, versus my blue bike with red streamers. Both can be used to make more bikes, in JavaScript. newBike = new Bicycle
newBike = Object.create(myBlueBike)
|
|
ahhhphilosophy.jpg