Loading topic
let and const, work with plain objects, and read array destructuring from the previous chapter. Array destructuring matches values by position. Object destructuring matches values by property name.2 min readlet, const, and calling functions.2 min readconst { a } = obj) and default values in patterns. Both were covered in earlier chapters. Here you will learn how to bind a property to a variable whose name differs from the property's key.2 min read...name slot that collects whatever the earlier parts of the pattern did not take.2 min read... syntax in a function's parameter list. It gathers any number of arguments into a single array.2 min readlet and const, work with arrays, and call functions. It also builds on the previous chapter, where ... in a parameter list collected arguments into an array. Here the same three dots do the opposite job. They expand an array into separate val2 min read... syntax inside { }. It copies an object's properties into a new object literal.2 min readproperty: newName, and default values with =. Nested destructuring combines those pieces. You write one pattern inside another, and the inner pattern matches the shape of the inner data.2 min readlet differs from const. So far, every pattern has appeared in a declaration such as const [a, b] = .... Patterns also work in plain assignments. A plain assignment updates variables that alr2 min readundefined, and destructuring null or 2 min readfor...of loops. Array patterns and array spread work with any iterable, not only with arrays. An iterable is any object that has a Symbol.iterator method returning an iterator2 min read{ ...obj }) and why its copies are shallow. Both of those were covered in earlier chapters. Object.assign(target, ...sources) is the older way to copy and merge objects, and you will still find it in many codebases. The two look interchangeabl2 min read