OOP 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 definition is writing out the function inside object and The call() method calls a function with a given this value and arguments provided individually
Describe method definition syntax (structure).
function name, colon, function key word, optional parameter, opening curly brace, code block, closing curly brace, comma.
How is a method different from any other function?
The difference is that a method is associated with an object, while a function is not
What is the defining characteristic of Object-Oriented Programming?
Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects. Encapsulation.
What are the four “principles” of Object-Oriented Programming?
Abstraction, Encapsulation, Inheritance, Polymorphism
What is “abstraction”?
Through the process of abstraction, a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency.
What does API stand for?
Application Programming Interface
What is the purpose of an API?
software intermediary that allows two applications to talk to each other
what is method call syntax?
object name.method(arguments)
What is this in JavaScript?
The JavaScript this keyword refers to the object it belongs to
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
When is the value of this determined in a function; call time or definition time?
the value of this is determined at call time.
Given the above character object, what is the result of the following code snippet? Why?
It’s a me Mario!
because this.firstName = firstName of character object
Given the above character object, what is the result of the following code snippet? Why?
“It’s-a-me Mario!”
because this.firstName = firstName of character object