Javascript topics Flashcards

1
Q

what are callbacks?

A

callbacks is when we pass a function as an arguement in another function to be invoked within that function. often use like do this thing then ___. can be sync or async

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

what are promises?

A

promises are a way we can handle async functions within javascript. they return an object which can be either Pending, Fulfilled, Rejected. The Promise object supports two properties: state and result.

While a Promise object is “pending” (working), the result is undefined.

When a Promise object is “fulfilled”, the result is a value.

When a Promise object is “rejected”, the result is an error object.

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

describe a closure

A

a func defined in a func that relies on data which lives in the outer func but when the inner func is returned it remembers the outer scope data. boss

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

what is the difference between var, const, and let

A

const is block scoped and cant be redefined, let is block scoped, var is function scoped

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

What are the different data types present in javascript?

A

idk know them all off the top of my head. or Number.
String.
Boolean.
Null.
Undefined.
BigInt.
Symbol.
Object.

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

what is this keyword in javascript.

A

just a reference to the execution context

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