Javascript-custom-methods Flashcards
What is a method?
A method is a function which is a property of an object. … Note: In JavaScript functions themselves are objects, so, in that context, a method is actually an object reference to a function.
How can you tell the difference between a method definition and a method call?
declare and define are the same, and they mean when you write all the code for your function. At that point the function just sits there doing nothing. call is when you tell the JavaScript interpreter to run the code in your function.
Describe method definition syntax (structure).
Method definition consists of a method header and a method body. The same is shown in the following syntax − Syntax modifier returnType nameOfMethod (Parameter List) { // method body } The syntax shown above includes − modifier − It defines the access type of the method and it is optional to use.
Describe method call syntax (structure).
What is the syntax for calling a method? A method must be created in the class with the name of the method, followed by parentheses (). The method definition consists of a method header and method body. We can call a method by using the following: method_name(); //non static method calling.
How is a method different from any other function?
A function is independent, whereas a method is a function linked with an object. Explicit data is passed on to a function, whereas a method completely passes the object on which it was called in the program. A method is Object-oriented programming while a function has standalone functionality.
What are the four “principles” of Object-Oriented Programming?
There are four major features in object-oriented programming that makes them different than non-OOP languages: abstraction, encapsulation, inheritance and polymorphism.
What is the defining characteristic of Object-Oriented Programming?
Object-oriented programming (OOP) is a programming paradigm based on the concept of “objects”, which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods).
What is “abstraction”?
abstraction boils down to being able to work with (possibly) complex things in simple ways.
What does API stand for?
Application programming interface
What is the purpose of an API?
An API (Application Programming Interface) is a set of functions that allows applications to access data and interact with external software components, operating systems, or microservices. To simplify, an API delivers a user response to a system and sends the system’s response back to a user.