Javascript Custom Methods Flashcards
What is a method?
A method is a function which is a property of an object. There are two kind of methods: Instance Methods which are built-in tasks performed by an object instance, or Static Methods which are tasks that are called directly on an object constructor.
How can you tell the difference between a method definition and a method call?
the definition has a block statement, function keyword and parameters and is being assigned to a property of an object
you can tell its a call if it has parenthesis and no code block, method is property of an object, not standalone
Describe method definition syntax (structure).
name: function (parametersd) {
code block
}
Describe method call syntax (structure).
object.method(arguments)
How is a method different from any other function?
Method is a property of an object
What is the defining characteristic of Object-Oriented Programming?
objects can contain both data (as properties) and behavior (as methods). takes related data and functionality and wraps them in an object
What are the four “principles” of Object-Oriented Programming?
Abstraction
Encapsulation
Inheritance
Polymorphism
What is “abstraction”?
being able to work with (possibly) complex things in simple ways.
What does API stand for?
An application programming interface (API) is a connection between computers or between computer programs.
What is the purpose of an API?
In fact, the purpose of every software API is to give programmers a way to interact with a system in a simplified, consistent fashion: aka, an abstraction. part of program to part of program