Methods
map()
var numbers = [0,1,2,3,4,5,6,7,8,9];
let numbersTwo = numbers.map(x => x * 3) //takes each of the elements of the array and multuplies them by 3
console.log(numbersTwo); //[0, 3, 6, 9, 12, 15, 18, 21, 24, 27]slice()
var numbers = [0,1,2,3,4,5,6,7,8,9];
console.log(numbers);
//First number is start.
//Second number is end. It will not print the end.
var numbersTwo = numbers.slice(0,3);
console.log(numbersTwo);
//We made a shallow copy, so the
//original array is still in tact.
console.log(numbers);
var numbersThree = numbers.slice(4,9);
console.log(numbersThree);splice()
File Location
Practice
Last updated