Object-Oriented Programming Flashcards
What is a method?
a method is a function which is a property of an object
How can you tell the difference between a method definition and a method call?
method call does not have a code block
Describe method definition syntax (structure).
method: function( ) { }
Describe method call syntax (structure).
Object.method( )
How is a method different from any other function?
method is associated with object, function is not
What is the defining characteristic of Object-Oriented Programming?
objects can contain both data (as properties) and behavior (as methods)
What are the four “principles” of Object-Oriented Programming?
abstraction, encapsulation, inheritance, polymorphism
What is “abstraction”?
simplifying complex behavior
What does API stand for?
application programming interface
What is the purpose of an API?
connects computers and programs to each other
What is ‘this’ in JavaScript?
implicit parameter of all JavaScript functions
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
When is the value of this determined in a function; call time or definition time?
call
How can you tell what the value of this will be for a particular function or method definition?
you can’t
How can you tell what the value of this is for a particular function or method call?
the object to the left of the dot