JS Codes Flashcards

(6 cards)

1
Q

.toUpperCase( )

A

Returns the calling string value converted to uppercase

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

Math.min( )

A

Returns the lowest-valued number passed into it

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

.push( )

A

Adds one or more elements to the end of an array and returns the new length of the array

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

Math.floor( )

A

Returns the largest integer less than or equal to a given number

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

.map( )

A

Creates a new array populated with the results of calling a provided function on every element in the calling array

const arr = [1, 4, 9, 16];
const map1 = arr.map(x => x * 2);
console.log(map1)
>>>>[2, 8, 18, 32]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

.reduce( )

A

Returns the sum of all the elements in an array

const arr = [1, 2, 3, 4];
const sum = arr.reduce((a, b) => a + b, 0);
console.log(sum);
»» 10

a=new total
b=array value

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