OOP Flashcards
What is amethod?
A function that is a property of an object
How can you tell the difference between a methoddefinitionand a methodcall?
Method definition is a shorter syntax for defining a function property in an object initializer.
Method call has an argument
Describe methoddefinitionsyntax (structure).
Var object = {
method() {
return ‘something’
}
};
Describe methodcallsyntax (structure).
methodName(argument);
How is a method different from any other function?
A method is associated with an object, while a function is not
Usually a method is group with other similar properties
What is thedefining characteristicof Object-Oriented Programming?
It stores data in objects to create better structured and reusable code
What are the four “principles” of Object-Oriented Programming?
Abstraction, Encapsulation, Inheritance, Polymorphism
What is “abstraction”?
The idea of breaking down something that is complex into simpler terms
What does API stand for?
Application Programming Interface
What is the purpose of an API?
To allow two or more programs to communicate with each other
What isthisin JavaScript?
“This” is the object that a method called with
What does it mean to say thatthisis an “implicit parameter”?
It is available in the code block even through it was never included in the function’s definition
Whenis the value ofthisdetermined in a function;call timeordefinition time?
The value of “this” is determined when the function is called
How can you tell what the value ofthiswill be for a particular function or methoddefinition?
You can’t tell?
How can you tell what the value ofthisis for a particular function or methodcall?
look at the object name to the left of the dot