Loading topic
length property. It also assumes you are comfortable with functions and running code in Node.js or a browser console.4 min readlet and const, arrow functions, and how to create arrays and read them by index. It covers two related pieces of syntax. Destructuring unpacks array elements into separate variables. Spread (...) expands an array into individual elements wherever a list of4 min readlet and const, can write arrow functions, understand that objects are accessed by reference, and can run code in Node.js or a browser console. You should also know how to create an array and read elements by index.4 min readpush, pop, shift, unshift, and splice. It assumes you can create arrays, index into them, and read length, and that you know the difference between mutating and non-mutating methods from the previous 4 min readawait, what they do with empty slots, and what happens if the array changes while you loop. This chapter 5 min readfor...of and forEach from the previous chapter. Most of the array methods you will meet next (map, filter, reduce, find, sort) share one mechanism: you hand them a function, and they call it for yo5 min read(element, index, array) covered in the previous chapter. It also assumes you can tell mutating methods from non-mutating ones. Here you will learn how map works, where it goes wrong, and 4 min read(element, index, array) callback signature covered earlier. It also assumes you know that some array methods change the original array and others return a new one.5 min read(element, index, array) callback signature that map and filter use. It also assumes you can read and write object properties. reduce uses that same callback pattern but adds one value that carries over from step to step. Most of the confu4 min read===), and the callback signature (element, index, array) from the earlier chapter on callbacks. You should also be able to run snippets in Node.js or a browser console.4 min readsplice and sort work, and how spread syntax unpacks an array. The focus here is on the methods that give you a new array and leave the original unchanged, and on the limits of the copies they make.4 min readmap, filter, reduce, the search methods such as find and some, and the difference between sort and toSorted. You should also be comfortable with arrow functions and template literals. Here you will combine those methods into pipelines, decide what 4 min readflat removes nesting levels, and flatMap transforms each element and then removes one lev4 min readSet of unique IDs, the entries of a Map, the characters of a string, the arguments object, and a DOM NodeList all hold ordered values. Most of them lack map, filter, and reduce. This chapter shows how to4 min readmap, filter, reduce, sort, the search methods, and the ES2023 copying methods. The focus here is on where those methods behave in ways you might not expect. The three biggest sources of bugs are sparse arrays, reduce wit4 min read