Array generate array when you need to generate an array of 0-99 scenario 1 const createArr = (n) => Array.from(new Array(n), (v, i) => i) const arr = createArr(100) // 0-99 array scenario 2 const createArr = (n) => new Array(n).fill(0).map((v, i) => i) createArr(100) // 0-99 array disrupt the array when you have an array, you need to disrupt the sorting of the array const randomSort = list => list.sort(() => Math.random() - 0.5) randomSort([0,1,2,3,4,5,6,7,8,9]) // randomly arrange the results Array deduplication when you need to keep only one for all the repeating elements in the array const removeDuplicates = list => [...new Set(list)] removeDuplicates([0, 0, 2, 4, 5]) // [0,2,4,5] most groups take intersection when you need to take the intersection of multiple arrays const intersection = (a, ...arr) => [...new Set(a)].filter((v) => arr.every((b) => b.includes(v))) intersection([1, 2, 3, 4], [2, 3, 4, 7, 8], [1, 3, 4, 9]) // [3, 4] find maximum index but you need to find an index of the largest value in the array const indexOfMax = (arr) => arr.reduce((prev, curr, i, a) => (curr > a[prev] ? i : prev), 0); indexOfMax([1, 3, 9, 7, 5]); // 2 find the minimum index when you need to find the index of the lowest value in an array const indexOfMin = (arr) => arr.reduce((prev, curr, i, a) => (curr < a[prev] ? i : prev), 0) indexOfMin([2, 5, 3, 4, 1, 0, 9]) // 5 find the nearest value when you need to find the closest value in an array const closest = (arr,…