Object Oriented Programming Flashcards
What is a method?
a function attached to an object
What does a method do?
perform a set of instructions written in the code block
What is this?
keyword that references the object
What does bind do?
returns a perman
What is the difference between a function and an object literal?
functions are objects that can be called
functions have a property named call: on them
What is the Prototypal Chain?
if javascript cannot find a method/property being called, it will go down the chain (__proto__) looking for that reference
What does the new keyword do?
Creates a blank, plain JavaScript object;
Links (sets the constructor of) this object to another object;
Passes the newly created object from Step 1 as the this context;
Returns this if the function doesn’t return an object.
What is the first thing that happens in a class when it is instantiated with the new keyword?
creates an empty object, then
calls the constructor method
Since classes are technically functions as well. Can you name a difference between classes and functions?
..
What is a static method?
methods that are attached to the creator object, but not to instantiated objects
What is the benefit of instantiating Classes within other classes?
so those classes inherit the properties of parents?
establishes a relationship/link between the two classes
(parent-child) relationship
Why are parent - child relationships important in OOP?
inheritance, reducing a lot of code
What is the basic idea of OOP?
replicate real life objects with code
What decides the order in which JS files must be loaded?
the order in which objects require data from other files
What is JSON?
JSON is a text-based data format following JavaScript object syntax