Promises
Callbacks & Functions
Async Await
Requests
Potpourri
100

JavaScript objects that represent the eventual result of an asynchronous operation.

Promises

100

A function that is passed as an argument to another function.

A callback function

100

The keyword that indicates an asynchronous function?

async

100

What API stands for.

Application Programming Interface

100

What the data-transfer format JSON stands for.

JavaScript Object Notation

200

The two possible outcomes of a promise that has been settled.

resolved and rejected

200

True or False: callback functions can handle both synchronous and asynchronous operations.

True

200

An operator used only inside of an async function that halts the execution of a function until a given promise is no longer pending and returns the resolved value of the promise.

await

200

The modern API for making a request from our JavaScript.

The fetch() API

200

A particular style of JavaScript (such as callbacks, promises, and async/await), that allows you to perform long network requests without blocking the main thread.

Asynchronous

300

Used with a success handler callback containing the logic for what should happen if a promise resolves.

.then()

300

How we would pass callback into myFunction as a callback function.

const callback = () => {. . .};

const myFunction = callback => {. . .};


myFunction(callback);

300

In order to use the await keyword, we have to wrap it within this kind of function.

Asynchronous

300

Type of HTTP method is used to read or retrieve a resource from an API.

GET

300

What HTTP stands for

Hypertext Transfer Protocol

400

Used with a failure handler callback containing the logic for what should happen if a promise rejects.

.catch()

400

The amount of time that would pass before the anonymous callback function would queue for execution.

setTimeout(()=>console.log("Hello learners!"), 11000);

11 seconds

400

The result of the following code:

async function myFunction() {
  return 'hello world';
}
myFunction()
.then((resolvedValue) => {
  console.log(resolvedValue);
})

'hello world' is printed to the console

400

The type of data that the GET and POST requests send and receive.

Objects

400

Built-in Node JavaScript function that sets a timer which queues a function or piece of code for execution when the timer expires

setTimeout()

500

Data type of the fulfilled value of Promise.all() ?

an Array

500

A term for the situation a programmer finds themself in when they nest too many callback functions inside of one another like the following example:

firstRequest(function(response) { 

   secondRequest(response,function(nextResponse) {  

       thirdRequest(nextResponse, function(finalResponse) {

           console.log('Final response: ' + finalResponse);

       }, failureCallback); 

   }, failureCallback);

}, failureCallback);

Callback Hell

500

The two possible {} block statements that follow a try block statement (One of the two is required, but there are two possibilities)

Catch and finally

500

The two possible parameters to a fetch statement (First one is required, second one is optional)

The URL, and options or init object

500

What an async function returns


async function example() { }

A promise