js custom methods Flashcards
What is a method?
a function which is a property of an object
How can you tell the difference between a method definition and a method call?
they look very different:
method definition is defined inside the object
method call has object.method();
Describe method definition syntax (structure).
const myObject = { myMethod: function (args) { //code } }
Describe method call syntax (structure).
myObject.myMethod();
How is a method different from any other function?
It’s inside of an object
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: simplification of a greater idea into something like an object that describes the whole with less information
Encapsulation: bundling data with methods in objects, keeping them separated from the rest of code
Inheritance: mechanism of basing an object or class on another object or class, retaining similar implementation
Polymorphism: use of a single interface with different types
What is “abstraction”?
Simplification of a larger system into an interface with only required information. Creating your very own black box
What does API stand for?
application programming interface
What is the purpose of an API?
give programmers a way to interact with a system in a simplified and consistent fashion.