JavaScript Flashcards

1
Q

What are the main HTTP methods?

A

GET, POST, PUT/PATCH, DELETE. REST APIs.

interact with data from servers.

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

HTTP Status Codes?

A
100 level - information status
200 level - success response
300 - redirect
400 - client-side error (ie. 404)
500 - server error
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Sync vs Async code?

A

synchronous - going in order.
asynchronous - go “do something” while rest of code continues. JS is single-threaded, but allows multiple things to happen at once.

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

What is a promise?

A

An easy way of handling asynchronous data. Useful for things like user input. will always either resolve or reject, then can handle accordingly. can chain promises with .then, i.e. using Fetch api. async await with ES6 is cleaner way of doing the same thing. need to use try/catch block when using async await.

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

how does async await work?

A

cleaner way of using promises. not chaining promises. async function, await the result. benefit is non-nesting, cleaner code. use try/catch to catch any errors.

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