Variables, Types & Collections Flashcards

1
Q

Method to flatten an array (depth 0+ or infinity for entire array)

A

.flat(depth)

.flat(Infinity) / .flat(1) / .flat(0)

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

Static array method to create an array from an array like collection

A

Array.from(arrayLikeCollection)

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

Create an array from arguments provided

A

Array.of(arguments)

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

Creates an array of the length specified by the argument

A

Array constructor

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

Which date methods can be used to display the time in the Coordinated Universal Time (UTC) zone?

A

toUTCString() provides a more human-readable format

and

toISOString()

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

Which date method returns the time in the users time zone with a plus or minus offset relation to UTC?

A

toString()

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

Which date method returns only the date portion and not the time?

A

toDateString()

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

How many falsy values are there in JavaScript and what are they?

A

There are 8 falsy values and they are false, 0, -0, 0n, ‘’ (empty string), null, undefined, and NaN (Not a Number).

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