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?
method definition: function code block assigned to a property
method call: object.method()
Describe method definition syntax (structure).
property: function () {}
Describe method call syntax (structure).
object.property();
i. e.,
calculator. square()
How is a method different from any other function?
functions are defined outside of classes, while methods are defined inside of and part of classes
What is the defining characteristic of Object-Oriented Programming?
data is encapsulated within objects and the object itself is operated on, rather than its component parts
What are the four “principles” of Object-Oriented Programming?
abstraction, encapsulation, inheritance, polymorphism
What is “abstraction”?
a way to reduce complexity and allow efficient design and implementation in complex software systems; it hides the technical complexity of systems behind simpler APIs
- helps the user to avoid writing low level code
- avoids code duplication and increases reusability
- can change internal implementation of class independently without affecting the user
- helps to increase security of an application or program as only important details are provided to the user
What does API stand for?
application programming interface
What is the purpose of an API?
abstraction
a set of features and rules that exist inside a software program (the application) enabling interaction with it through software - as opposed to a human user interface
a set of code features (e.g. methods, properties, events, and URLs) that a developer can use in their apps for interacting with components of a user’s web browser, or other software/hardware on the user’s computer, or third party websites and services