Object Oriented Programming (OOP) Flashcards
What is a method?
a function stored in the property of an object
How can you tell the difference between method definitions and method calls?
method definition will always have the function keyword and a code block.
method call is always attached to an object.
Describe method call syntax:
object.method( )
How is a method different from any other function?
a method is a property of an object
What is the defining characteristic of object-oriented-programming (OOP)?
objects can contain both data and behavior(methods)
What are the four principles of object-oriented-programming?
Abstraction, Encapsulation, Inheritance, Polymorphism
What is “abstraction”?
being able to work with complex things in simple ways
What does API stand for?
Application Programming Interface
What is the purpose of an API?
communication between two softwares
What is this in JavaScript?
an implicit parameter of all JavaScript functions - the object that we’re working in
What does it mean to say that ‘this’ is an “implicit parameter”?
it is available in a function’s code block even though it was never included in the function’s parameter list or declared with var
When is the value of this determined in a function? Call time or definition time?
call time - this does not exist/have value until the function is called
How can you tell what the value of this will be for a particular function or method definition 👀?
you cant - if a function is just being defined, this does not exist yet
How can you tell what the value of this is for a particular function or method call 👀?
check the object to the left of the dot
What kind of inheritance does the JavaScript programming language use?
prototype-based inheritance (prototypal inheritance)