Module 2 Flashcards

1
Q

What is a method?

A

A method is a function which is a property of an object.

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

Methods are defined within the object literal in a series of function definitions, a method is called as a property of the object called when optional parameters are included in the parenthesis

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

Describe method definition syntax (structure).

A

Methods are defined in the object literal using a method name : function (parameters) { code block for function definition }

or using the dot notation and assigning it a value
can see that there is a defined body to that method

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

Describe method call syntax (structure).

A

object.methodName(parameters);

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

It is attached to an object and must be called as a method of the object that describes the behavior of the object (property of the object)

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

What is the defining characteristic of Object-Oriented Programming?

A

Objects contain both data (properties) and behavior (methods)
take related data and functionality and wrap them together in something called an object

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

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

A
  1. Abstraction
  2. Encapsulation
  3. Inheritance
  4. Polymorphism

would add a fifth called XYZ

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

What is “abstraction”?

A

the most important part of the term “abstraction” boils down to being able to work with (possibly) complex things in simple ways.

wrapping complex tasks in simple interfaces

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

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

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

What is this in JavaScript?

A

an implicit parameter of all javascript functions

a JS keyword that references the current object you are in

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

What does it mean to say that this is an “implicit parameter”?

A

meaning that it is available in a function’s code block even though it was never included in the function’s parameter list or declared with var

implied parameter - changed based on how you call the method but it is implied bc you don’t actually list it out in the parameter list

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

Given the above character object, what is the result of the following code snippet? Why?
character.greet();

A

It’s-a-me, Mario! because this refers to the character object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
Given the above character object, what is the result of the following code snippet? Why?
var hello = character.greet;
hello();
A

It’s-a-me, undefined!

because the function is not being called with the object this is referring to to the left of the dot

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

How can you tell what the value of this will be for a particular function or method definition?

A

You cannot, you can only tell the value of this when the function is called

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
Given the above character object, what is the result of the following code snippet? Why?
var hello = character.greet;
hello();
A

It’s-a-me, undefined!
because the function is not being called with the object this is referring to to the left of the dot

because this then refers to the window, not the object

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

How can you tell what the value of this will be for a particular function or method definition?

A

You cannot, you can only tell the value of this when the function is called

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

How can you tell what the value of this is for a particular function or method call?

A

Look for an object to the left of the dot and if there is none, it will default to the window object

if not in the global scope, it will be undefined

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

What is a prototype in JavaScript?

A

an object that contains primarily methods and properties that can be used by other objects

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

What is a prototype in JavaScript?

A

an object that contains primarily methods and properties that can be used by other objects

property lookup on an object if the object doesn’t have it, it looks to that object’s prototype to see if that has the property

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

If an object does not have its own property or method by a given key, where does JavaScript look for it?

A

to the prototype object

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

If an object does not have its own property or method by a given key, where does JavaScript look for it?

A

to the prototype of the current object

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

What does the new operator do?

A
  1. Creates a blank, plain JavaScript object.
  2. Adds a property to the new object (__proto__) that links to the constructor function’s prototype object
  3. Binds the newly created object instance as the this context (i.e. all references to this in the constructor function now refer to the object created in the first step).
  4. Returns this if the function doesn’t return an object.
  5. Creates a blank object
  6. Sets that object’s prototype (__proto__) to equal the prototype property of the function it is called on (constructor)
  7. Runs the constructor function with ‘this’ that referring to new object
  8. Returns the return value of the function or the constructor function or if undefined, gives you back that new object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What property of JavaScript functions can store shared behavior for instances created with new?

A

__proto__

prototype property

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

What does the instanceof operator do?

A

The instanceof operator tests to see if the prototype property of a constructor appears anywhere in the prototype chain of an object. The return value is a boolean value.

The instanceof operator tests the presence of constructor.prototype in object’s prototype chain.

Allows you to check if an object is an instance of a constructor

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

What is a “callback” function?

A

a function passed into another function as an argument

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

Besides adding an event listener callback function to an element or the document, what is one way to delay the execution of a JavaScript function until some point in the future?

A

setTimeout(callbackfunction, delayInMiliseconds)

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

How can you set up a function to be called repeatedly without using a loop?

A

setInterval(callbackfunction, delayInMiliseconds)

clearInterval(Integer that corresponds to your result value from setInterval call)

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

What is a client?

A

hardware or software that is requesting functionality or services

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

What is a server?

A

a hardware or software that provides functionality for other programs or devices

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

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET method

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

What three things are on the start-line of an HTTP request message?

A
  1. method
  2. target - specified by the URL (not the entire one, it’s the absolute path)
  3. version
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What three things are on the start-line of an HTTP response message?

A
  1. version - of the http (1.1 or 1.0)
  2. status code
  3. status test
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What are HTTP headers?

A

allow the client and the server to pass additional information
meta information / not the core data
extra contextual information (i.e. head tag of an HTML document)

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

Where would you go if you wanted to learn more about a specific HTTP Header?

A

MDN
i.e. content-type header can search on MDN
by convention, custom headers start with an X

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

Is a body required for a valid HTTP request or response message?

A

no, it is optional for both

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

httPie

A

tool for performing raw http requests (without a browser)

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

What is AJAX?

A

a technique for loading data into the page without having to refresh the page

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

What does the AJAX acronym stand for?

A

Asynchronous JavaScript And XML
(acronym for the technologies used in asynchronous requests)

XML = extensive markup language (extension of HTML where there is no limit for tag names, used as an interchange format, before JSON used for sending raw data back and forth)

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

Which object is built into the browser for making HTTP requests in JavaScript?

A

XMLHttpRequest

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

What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?

A

load

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

An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?

A

there is an EventTarget prototype object that is the prototype of the XMLHttpRequest that has the addEventListener method

both DOM elements and XMLHttpRequest objects inherit the method from the same prototype (EventTarget) that does have that method

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

What is a code block? What are some examples of a code block?

A

a code block is denoted by {} and typically stems from a conditional statement i.e. if, if else, else, for, while, try

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

What does block scope mean?

A

the scope of the variable is local to the code block which it was initialized in

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

What is the scope of a variable declared with const or let?

A

block scope

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

What is the difference between let and const?

A

with const, variable is read-only reference to a value

can’t reassign the variable but can change the internals of it

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

Why is it possible to .push() a new value into a const variable that points to an Array?

A

because it is not directly redefining the array, since it is pointing to the array, you can manipulate it with the given methods .push & .pop but you cannot re-initialize the whole array variable to new values

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

How should you decide on which type of declaration to use?

A

depends on use case

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

What is the syntax for writing a template literal?

A

using back ticks

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

What is “string interpolation”?

A

substituting part of the string with a variable

concept, javascript template literal is an example of this

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

What is destructuring, conceptually?

A

destructuring allows you to assign properties of an object or elements of arrays to individual variables by flipping the literal on its head
can select multiple properties or indexes in the same statement
opposite of structuring - filling it with data
destructing is reverse - pulling data out of it

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

What is the syntax for Object destructuring?

A

let {property1: variable1, property2: variable2, property3:variable3} = Object

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

What is the syntax for Array destructuring?

A

let [variable1, variable2, variable3] = Array

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

How can you tell the difference between destructuring and creating Object/Array literals?

A

destructuring is similar syntax, but flipped on its head. You assign the already declared object or array to the newly declared variables directly defined in the literal & its properties or elements

55
Q

What is the syntax for defining an arrow function?

A

(parameters) => expression

(parameters) => { statements}

56
Q

When an arrow function’s body is left without curly braces, what changes in its functionality?

A

the return value of the expression is returned. you do not need to specify the return keyword

57
Q

How is the value of this determined within an arrow function?

A

Arrow function captures the this value of the enclosing context instead of creating its own this context / more localized

58
Q

What is a CLI?

A

Command Line Interface

terminal where you input text commands and it executes stuff

59
Q

What is a GUI?

A

Graphic User Interface
graphics base operating interface
IDEs
something that is optimized for humans to use (window, has text, has images, can have audio, can interact with the mouse, you can type on it)

60
Q
Give at least one use case for each of the commands listed in this exercise.
man
cat
ls
pwd
echo
touch
mkdir
mv
rm
cp
A

man = manual
if you wanted to read through a specific command to see how it is used you can run through the terminal manual to find what it is about

cat = concatentate to concatenate and print files on the terminal
if you want to see 3 files printed side by side in the terminal

ls = list lists out files of working directory

pwd = print the name of the current working directory

echo = display a line of text

touch = change file timestamps

mkdir = make directories

mv = move or rename files

rm = removes files or directories

cp = copy source files & directories

61
Q

What is Node.js?

A

Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine.

Allows the context to be expanded to servers outside of the browser so that you can use JS in context expanded from just the DOM

ripped out of the browser surrounded by an API that allows V8 to work, including web servers

Node.js is a program that allows JavaScript to be run outside of a web browser

62
Q

What can Node.js be used for?

A

It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.

63
Q

What is a REPL?

A

Read–eval–print loop

a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the use - similar to a console.log

64
Q

When was Node.js created?

A

2009

65
Q

What back end languages have you heard of?

A

Python, C++, C#, Java, Ruby, PHP, Perl

66
Q

What is a computer process?

A

a process is the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity.

it is an instance of the program which contains a task list/list of instructions to execute that has been copied from disk to memory (RAM) and then executed by the CPU via one or more threads

67
Q

Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?

A

a lot, about 200-300+

68
Q

Why should a full stack Web developer know that computer processes exist?

A

Full stack Web development is based on making multiple processes work together to form one application, so having at least a cursory awareness of computer processes is necessary. Especially when working with applications made of multiple components, such as clients, servers, and databases.

Tier 3 application:
client process
server process
database process
so you can kill them - sometimes you need to kill the ones you don't want to run & can stop them from running
69
Q

What is the process object in a Node.js program?

A

a global object that provides information about the current Node.js process & control over it

all of the info about the currently running process

70
Q

How do you access the process object in a Node.js program?

A

global so you can access just by calling process

can also call the require function with the ‘process’ argument

71
Q

What is the data type of process.argv in Node.js?

A

array of strings containing command line arguments

72
Q

What is a JavaScript module?

A

The whole idea behind modular programming is to decompose a solution to a large problem into many smaller solutions to sub-problems.

a way of breaking javascript code into multiple files 
their scope is module scope  (they each have their own local scope)
73
Q

What values are passed into a Node.js module’s local scope?

A
\_\_dirname
\_\_filename
exports 
module
require

way loads modules, loads the raw string from the file & wraps it in in a wrapper & provides a unique value to the module with those 5 things

74
Q

Give two examples of truly global variables in a Node.js program.

A

console
process
setTimeOut
setInterval

75
Q

What is the purpose of module.exports in a Node.js module?

A

helps to share functions or variables between files

76
Q

How do you import functionality into a Node.js module from another Node.js module?

A
module.exports
var variable = require('path to module/module name')
imports / export keywords
77
Q

What is the JavaScript Event Loop?

A

checks the stack and the task queue and if the stack is empty, moves the first item in the task queue to the stack to be executed

78
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A

blocking is when code takes a really long time to execute bc JS can only do one thing at a time since it runs on a single thread
non-blocking is in reference to multi thread or asynchronous runtime behaviors

operations that block for executions until previous is complete = synchronous
operations that do not wait for other functions to execute = asynchronous runs alongside and then gets added at the end

79
Q

difference between exports and module.export

A
initially they both point to the same object 
module.exports = { }
var exports = module.exports

if you reassign exports variable to another value, the exports won’t refer to the module.exports anymore

exports is shorthand

but module.exports is the authoritative - if you completely reassign, you have to go with module.exports

80
Q

What is a directory?

A

a folder houses a list of file names that it contains and points to the files themselves (pointer to the actual files, not the actual files)

81
Q

What is a relative file path?

A

a shorthand for a path within the same root directory
./dir
../parentdir
filename or dir

82
Q

What is an absolute file path?

A

the full path starting with the root of the file system to the corresponding file
/home…
~/ starting from the home directory of the current user (shorthand for /home/username)

83
Q

What module does Node.js include for manipulating the file system?

A

File System Module (fs)

84
Q

What method is available in the Node.js fs module for writing data to a file?

A

fs.writeFile

85
Q

fs.write file is synchronous or asynchronous?

A

asynchronous

86
Q

What is a client?

A

computer hardware or software that accesses services made available by a server

makes requests to a server and interprets their responses

87
Q

What is a server?

A

computer hardware or software that provides data or functionality to a client

listens for network requests and responds to them

88
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET

can go to the network tab and see the the request types

89
Q

What is on the first line of an HTTP request message?

A

Start line with your:

  1. HTTP method i.e. GET, PUT, POST
  2. Request Location URL
  3. HTTP Protocol Version
90
Q

What is on the first line of an HTTP response message?

A
  1. HTTP Protocol Version
  2. Status Code - 404, 302, or 200
  3. Status Descriptor (brief descriptor of the status code)
91
Q

What are HTTP headers?

A

HTTP headers let the client and the server pass additional information with an HTTP request or response.

Request headers contain more information about the resource to be fetched, or about the client requesting the resource.

Response headers hold additional information about the response, like its location or about the server providing it.

the headers refers to meta information about the request or response, body is the actual content of that response

92
Q

Is a body required for a valid HTTP message?

A

no - not at a protocol level, it is always optional.

when you work with APIs or designing APIs you want the body to be required sometimes, but this is at the app level, not the protocol level

93
Q

What is NPM?

A

(Node Package Manager used to stand for, but expanded so much that it wasn’t just for node packages)
a library / registry where developers can share reusable code that help solve specific problems

94
Q

What is a package?

A

a directory that contains a file or files of reuse-able code that is shared on npm

95
Q

How can you create a package.json with npm?

A

npm init

96
Q

What is a dependency and how to you add one to a package?

A

used to specify that our package is compatible with a specific version of an npm package

dependency is another package of software that your package of sotftware depends on

npm install package.json
npm install express

97
Q

What happens when you add a dependency to a package with npm?

A

creates a node_modules directory
updates your package.json dependencies
downloads that to the modules folder then goes into that package.json file and adds dependencies & adds whatever else is needed until everything has been unwrapped

dependencies = list of things to download

98
Q

How do you add express to your package dependencies?

A

by using npm to install the express package

npm install express

99
Q

What Express application method starts the server and binds it to a network PORT?

A

app.listen( )

web traffic default port #
normal: 80
secure (https): 443

default response to any request made on the express server: 404 Not Found, content of the page is cannot GET or cannot POST

100
Q

How do you mount a middleware with an Express application?

A

app.use( )

101
Q

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

req & res

102
Q

What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?

A

application/json

103
Q

What is the significance of an HTTP request’s method?

A

indicates the desired action to be performed for a given resource

104
Q

What does the express.json( ) middleware do and when would you need it?

A

This method is used to parse the incoming requests with JSON payloads and is based upon the bodyparser. This method returns the middleware that only parses JSON and only looks at the requests where the content-type header matches the type option

express middleware than parses raw json string body into an object and attaches it to the body of the request object - need it when you want to use the contents of an application/requestbody

105
Q

What is PostgreSQL and what are some alternative relational databases?

A

Relational Database Management System that is free /open source and gets improvements each year (has been around for 30 years)

Other popular relational databases include MySQL (also free), SQL Server by Microsoft, and Oracle by Oracle Corporation.

Many relational database systems have an option of using the SQL (Structured Query Language) for querying and maintaining the database

106
Q

What are some advantages of learning a relational database?

A

you are able to use SQL language with them
If you are storing related data, then a relational database is probably a good first choice! (data related to each other like teachers, students, classes, classrooms). SQL is a gateway to all database languages

they support good guarantees about data integrity. They can store and modify data in a way that makes data corruption as unlikely as possible. This means that developers can set up their database to reject “bad” data and not worry about data being “half written”.
ACID compliant transaction - if it tells you something successful, will tell you, but won’t happen at all if doesn’t work

access data with single statement & declarative and you don’t have to tell it HOW to get the data, just want to tell it what you want

3/4 of all databases used in a live web app use relational databases

107
Q

What is one way to see if PostgreSQL is running?

A

sudo service postgresql status

or can check with top

108
Q

What is a database schema?

A

A collection of tables is called a schema. A schema defines how the data in a relational database should be organized. In relational databases, you typically have to define your schema up front and the database server will make sure that any data being written to the database conforms to that schema.

109
Q

What is a table?

A

container data stored in relations

A table is a list of rows each having the same set of attributes (columns)

110
Q

What is a row?

A

rows contain data with the same sets of attributes that build tables (attributes = columns)

columns = fields that the record can have
row = a record of data
111
Q

What is SQL and how is it different from languages like JavaScript?

A

it is a declarative language which means programmers describe the results that they want to get out of it and the language in turn tries to fetch accordingly.

JS is an imperative language where programmers tell it what to do and how to do it

query execution strategy - IT figures out the steps that it takes

112
Q

How do you retrieve specific columns from a database table?

A

using the select statement

select “name”,
“price” (column names)
from “products”; (table name)

order of the results are not predictable

if table name or column name is lowercase, don’t need the quotes

113
Q

How do you filter rows based on some specific criteria?

A

where “column name” = ‘specific value’

can add conditionals & logical operators

114
Q

What are the benefits of formatting your SQL?

A

Helps us to make the queries more readable and easy to understand
When the queries are formatted and laid out with proper spacing it comes easy to find the errors in the query and fix the error

115
Q

What are four comparison operators that can be used in a where clause?

A

= < > != =< =>

116
Q

How do you limit the number of rows returned in a result set?

A

limit statement with integer

offset - used to skip rows

117
Q

How do you retrieve all columns from a database table?

A

select statement with an *

118
Q

How do you control the sort order of a result set?

A

order by statement + “columnName” or an expression or a comma separated list of columns
can order by descending with desc at the end

119
Q

How do you add a row to a SQL table?

A

insert into “table” (“list of columns”)

values (‘values’)

120
Q

What is a tuple?

A

ordered set of values in-between list and an object - each position in the tuple has a specific meaning. Each row is a tuple - values are jammed together & has a known size to recognize what is what
every row is a tuple of the same size so that the engine knows where to go to grab each column

121
Q

How do you add multiple rows to a SQL table at once?

A

insert into “table” (“column1, “column2”)
values (first one),
(second one)

122
Q

How do you get back the row being inserted into a table without a separate select statement?

A

returning statement with an *

123
Q

How do you update rows in a database table?

A

update “table”
set “column” = ‘value’
where ….

124
Q

Why is it important to include a where clause in your update statements?

A

if it is not included, updates for all rows

125
Q

How do you delete rows from a database table?

A

delete from “table”
where …
can use and

126
Q

How do you accidentally delete all rows from a table?

A

without using the where statement
can also clear out tables - truncate clears data but keeps table definition
drop removes table definition entirely - destroy database

127
Q

What is a foreign key?

A

when tables share the same columns / values

connects two tables together - constraint on one table that says it can only contain a value from another table

128
Q

How do you join two SQL tables?

A

using join statement
select *
from “first table”
join “second table” using (“foreign key”)

Join “table2” ON “table1”.”table1Id” = “table2”.”table2Id”

129
Q

How do you temporarily rename columns or tables in a SQL statement?

A

select “name”. as “product”

130
Q

What are some examples of aggregate functions?

A
max 
min
avg
count
count distinct - counts only unique values
sum
131
Q

What is the purpose of a group by clause?

A

sometimes you want to ask questions about specific groups of data that share the same values across various attributes

based on a column or calculated value

i.e. find out the avg prices of all the products with the category “toys” and separately want to get an average price on all that are “electronics”

132
Q

What are the three states a Promise can be in?

A
  1. pending
  2. fulfilled
  3. rejected
133
Q

How do you handle the fulfillment of a Promise?

A

using .then( ) method

134
Q

How do you handle the rejection of a Promise?

A

.catch( ) method