Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 1.05 KB

arrays.md

File metadata and controls

30 lines (23 loc) · 1.05 KB

Bookmarks tagged [arrays]

https://stackoverflow.com/questions/5767325/how-can-i-remove-a-specific-item-from-an-array

const array = [2, 5, 9];

console.log(array);

const index = array.indexOf(5);
if (index > -1) {
  array.splice(index, 1);
}

// array = [2, 9]
console.log(array); 

https://kentcdodds.com/blog/array-reduce-vs-chaining-vs-for-loop

A comparison of different approaches to operating on an array