object orientated programing Flashcards
What is a method?
a function that is associated with an object
How can you tell the difference between a method definition and a method call?
method definition starts with the function keyword, method call has the parantheses and an argument
Describe method definition syntax (structure).
property name colon and function
Describe method call syntax (structure).
object name and method name and then function plus arguments
How is a method different from any other function?
methods are associated with objects,
What is the defining characteristic of Object-Oriented Programming?
object oriented programing relies on encapsulation/ grouping similar values and functions or methods all in one place
What is “abstraction”?
simplifying complex things
What does API stand for?
application programming interface
What is the purpose of an API?
it is the connection between programs and computer hardware, to allow someone else to interact with your program
What is the purpose of an API?
it is the connection between programs and computer hardware, to allow someone else to interact with your program.
What is this in JavaScript?
his keyword refers to the object it belongs to
What does it mean to say that this is an “implicit parameter”?
An implicit parameter is opposite to an explicit parameter, which is passed when specifying the parameter in the parenthesis of a method call.
When is the value of this determined in a function; call time or definition time?
call time
What does this refer to in the following code snippet? var character = { firstName: 'Mario', greet: function () { var message = 'It\'s-a-me, ' + this.firstName + '!'; console.log(message); } };
the character object
Given the above character object, what is the result of the following code snippet? Why?
character.greet();
its a me mario