Object Oriented Programming Flashcards
What is a method?
Value of property of an object that is a function
How can you tell the difference between a method definition and a method call?
method definition has the function keyword and codeblock is in the object literal while method call has parenthesis attached at the end
Describe method definition syntax (structure).
property name then colon then function definition
Describe method call syntax (structure).
object dot notation property then parenthesis
object.property()
How is a method different from any other function?
is within an object
What is the defining characteristic of Object-Oriented Programming?
based around objects that have data and behavior
what are the four “principles” of Object-Oriented Programming?
abstraction, encapsulation, inheritance, polymorphism
What is “abstraction”?
Simplifying a complex method such as turning on/off a lightbulb when in reality it is closing and opening circuits of electricity that give volts to a lightbulb source
What does API stand for?
Application program interface
What is the purpose of an API?
communication method between softwares.
What is this in JavaScript?
refers to the obj
What does it mean to say that this is an “implicit parameter”?
it means that the parameter is not given but it is not given
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); } };
this is undefined until called
How can you tell what the value of this will be for a particular function or method definition?
no way to know what this
is when a function is called