NobleBlocks

Research index

Destructuring

24 Jun 2020

NobleIDark:/48914/w1/20260525/99A444C6DOI10.1002/9781119367901.ch7

Paywalled

The full text is at the publisher

You can read the abstract here, or open it at the publisher.

Read at the publisher

Abstract

This chapter discusses object destructuring, which provides powerful syntax for extracting values from objects and arrays into variables. Destructuring syntax, added in ES2015 and extended in ES2018, provides clarity and expressiveness, particularly when applied to function parameters. Just as object destructuring uses the exact same syntax as an object literal, array destructuring uses the exact same syntax as an array literal. The chapter describes how to use the rest syntax and property names in destructuring patterns and discusses nested destructuring and parameter destructuring. In JavaScript, there are some assignments that don't look a lot like assignments. In particular, the for-in and for-of loops assign to the loop variable at the beginning of each loop iteration. The chapter explores how to perform destructuring in loops.

Discussion

Topics

More

Suggest a correction or report