New Array Methods Part 2
محتوى الدرس
main.js
/*
New Array Methods
Array.find()
Array.findIndex()
Array.copyWithin()
*/
// Array.find() Not Returning All Values
let myNumbers1 = [1, 10, 20, 30, 40];
let found1 = myNumbers1.find(el => el > 10);
console.log(found1);
console.log(`${"#".repeat(20)}`);
// Array.findIndex() Not Returning All Values
let myNumbers2 = [1, 10, 20, 30, 40];
let found2 = myNumbers2.findIndex(el => el > 10);
console.log(found2);
console.log(`${"#".repeat(20)}`);
// Array.copyWithin(Target, Start Default 0, End Default Array.length)
// "A", "F", "G", "D", "E", "F", "G", "H"
let myLetters = ["A", "B", "C", "D", "E", "F", "G", "H"];
myLetters.copyWithin(1, 5, 7);
console.log(myLetters);