I'm currently studying classes so I thought it would tie in nicely to what we're discussing here.
This reminds me of the .prototype we talked about earlier.
a) So according to my search on Google:
b) 3. is probably what we were talking about with:
c) I just realized that in the case above: .prototype is a property while .drawItem is a method. From what I understand, this structure is typical of prototypal instantiation.
d) In the
cons of that instantiation I read:
The
constructor function is something we also talked about previously with Zevia.
e) Further into the exercise, there is discussion of the
.constructor method which is limited to classes. Doing a quick 'ctrl+F', I find that method used in the windows.js:
Image 5
...which is cool when you see something you're learning actually used in practice.
f) The class I had to create in my exercise admittedly looks very different than the classes above:
For instance:
Line 1: I use curved braces after my class declaration while above only use parentheses.
Line 3: I use .this but there's none in
image 5... although it used in a different class:
Image 6
which means we don't always use .this with every class, just some of them.
Line 1: I don't use the assignment operator while they do in
image 6.
g) So an
instance is:
An instance is an object that contains the property names and methods of a class, but with unique property values.
What would be considered an example of an instance in rpg_windows.js?