Javascript-custom-methods Flashcards

1
Q

What is a method?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you tell the difference between a method definition and a method call?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe method definition syntax (structure).

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe method call syntax (structure).

A
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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How is a method different from any other function?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the four “principles” of Object-Oriented Programming?

A

There are four major features in object-oriented programming that makes them different than non-OOP languages: abstraction, encapsulation, inheritance and polymorphism.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the defining characteristic of Object-Oriented Programming?

A

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).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is “abstraction”?

A

abstraction boils down to being able to work with (possibly) complex things in simple ways.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does API stand for?

A

Application programming interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the purpose of an API?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly