Loading topic
length property that tracks those positions automatically. This chapter covers creating arrays, reading and writing elements by index, and h2 min readlength property, all covered in the previous chapter. You should also be comfortable running snippets in Node.js or a browser console.2 min readlet and const, arrow functions, and how to index an array with arr[0] and read arr.length. It covers two pieces of syntax that use the same brackets and dots in opposite directions. Destructuring unpacks an array into variables. Spread unpacks an array into a ne2 min readlet and const, write arrow functions, and run code in Node.js or a browser console. You should also know how to create an array and read elements by index.2 min readconst and let, write arrow functions, and use for loops. You should also know from the previous chapter that some methods mutate an array in place. Every method here does: push, pop, shift, unshift, and splice all change the origina2 min readlet and const, arrow functions, and the classic for (let i = 0; ...) loop, and that you can run code in Node.js or a browser console. It also uses array destructuring from the earlier chapter.2 min readfor...of or forEach. Methods such as map, filter, find, and some all rely on the same mechanism, so learning it once makes each of those methods easier to pick up.2 min read(element, index, array) callback signature from the previous chapter. It also assumes you know the difference between mutating and non-mutating methods.2 min read(element, index, array) callback signature from the callbacks chapter, and the difference between mutating and non-mutating methods.2 min read(element, index, array) and how map and filter return new arrays. reduce works differently. It walks the array and folds every element into a single result. That result can be a number, a string, an object, or even another arr2 min read(element, index, array) callback signature from the earlier chapter on callbacks. The methods below answer a question about an array without changing it. None of them mutate the array.2 min readsort decides element order and how to make it put elements in the o2 min readpush, splice, and sort change an array in place. It covers how to get a new array when you need one and leave the original as it was. That matters when an array is shared, for example in application state, a function argument, or a value2 min readmap, filter, reduce, and toSorted, and that you can tell mutating methods from non-mutating ones. It shows how to connect those methods into one readable pipeline.2 min readmap and the (element, index, array) callback signature. It also assumes you know the difference between methods that mutate an array and methods that return a new one.2 min readmap and reduce methods from earlier chapters. You will learn to turn values that look like arrays, or that can be looped over, into real arrays that have every array method.2 min readmap, filter, reduce, sort, and the difference between methods that mutate an array and methods that copy it. It covers three behaviors that cause bugs even in experienced developers' code: holes in sparse arrays, reduce called without an initial value,2 min read