JS Codes Flashcards
(6 cards)
1
Q
.toUpperCase( )
A
Returns the calling string value converted to uppercase
2
Q
Math.min( )
A
Returns the lowest-valued number passed into it
3
Q
.push( )
A
Adds one or more elements to the end of an array and returns the new length of the array
4
Q
Math.floor( )
A
Returns the largest integer less than or equal to a given number
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]
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