Arrays and collections

This part of the JavaScript course starts with arrays: a literal, the writable length, the methods that change an array in place and the ones that return a copy, a comparator for sort, and the search methods. Map takes keys of any type, Set keeps unique values, and WeakMap holds an object without keeping it alive. A plain object works as a map too, with the prototype keys that come with it, and Object.groupBy buckets a list. Typed arrays read the bytes of an ArrayBuffer, and the last lesson picks a collection for the same task four times.

049 Arrays: creating, length and holes a literal against new Array and Array.of, index and at, the writable length, holes left by delete and the methods that skip them, Array.from over a string, a Set, a Map and arguments Open 050 Changing arrays: push, pop, splice push and pop at the end, shift and unshift with the reindexing, splice to remove, insert and replace, and the value each method returns Open 051 Sorting arrays with a comparator the default string order, a comparator that answers with a number, the stable sort of records, and toSorted that returns a new array Open 052 Searching arrays: find, includes, some and every indexOf and includes with the NaN case, find, findIndex and findLast, some and every on an empty array, and the identity problem of a list of objects Open 053 Copying arrays without mutation the shallow spread copy, toSorted and toReversed, with for one position and its RangeError, toSpliced against splice Open 054 Map: keys of any type set, get, has, delete and size, object and function keys compared by identity, the insertion order an update keeps, and the three ways to walk a map Open 055 Sets: unique values and set operations unique values from an array, has, add and delete, the identity rule for objects, and union, intersection, difference and subset checks written with a Set Open 056 WeakMap and WeakSet: keys that can be collected the keys a strong Map keeps alive, the four methods of a WeakMap, no size and no iteration, the TypeError on a primitive key, and an id kept for an object Open 057 Plain objects as maps the prototype keys a lookup finds, in against Object.hasOwn, Object.create(null) and the spread copy that restores a prototype, and the keys that become text Open 058 Grouping with Object.groupBy and Map.groupBy Object.groupBy with a null prototype, counting with a Map, Map.groupBy for keys that are objects, and the groupBy written by hand Open 059 Typed arrays: ArrayBuffer and byte views a buffer and its Uint8Array view, the overflow that wraps at the element type, several views with their byteOffset, and TextEncoder for text Open 060 Choosing a collection one task solved with arrays, with a Map and a Set and with a plain object, and a table of the four collections with the reason to pick each Open

Lessons