What is a method?
a function which is a property of an object
How can you tell the difference between a method definition and a method call?
- a method call is like a function call with object name dot and method name followed by parenthesis
Describe method definition syntax (structure).
Describe method call syntax (structure).
object name, dot, method name, parenthesis
objectName.methodName()
How is a method different from any other function?
need dot or bracket notation to see what object the method in
What is the defining characteristic of Object-Oriented Programming?
- data and behavior are combined
What are 4 principles of OOP?
Abstraction
Encapsulation
Inheritance
Polymorphism
What is “abstraction”?
What does API stand for?
application programming interface
What is the purpose of an API?
What is ‘this’ in JavaScript?
a property of an execution context that is a reference to its enclosing object
What does it mean to say that ‘this’ is an “implicit parameter”?
‘this’ is available in a function’s code block, even though it was never explicitly declared
When is the value of this determined in a function; call time or definition time?
call time
How can you tell what the value of this will be for a particular function or method definition?
you don’t know until it is called
How can you tell what the value of this is for a particular function or method call?
What kind of inheritance does the JavaScript programming language use?
prototypical inheritance, which is reusing objects as prototypes to allow for the inheritance of methods and properties
How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on objects, arrays, and numbers?
those methods are defined on those elements’ __proto__ property
If an object does not have its own property or method by a given key, where does JavaScript look for it?
looks for it on the prototype object which it is inheriting properties/methods from
What does the new operator do?
What property of JavaScript functions can store shared behavior for instances created with new?
prototype property
What does the instanceof operator do?