Waudby
Guest
- 0
- Posts
I have a question. What is a prototype?
In javascript, a prototype is a form of inhertience. So that you can extend the object to do extra things.
For example, the example you gave of "Battle.prototype" basically says to the engine, that it wants to take the object (which in this case is Battle) and add to it's properties.
This allows me to use all of the properties of the object selected, for instance the "this.player" and the "this.enemy" properties from withing the main declaration.
Hopefully this is easy enough to understand?