JavaScript Introducing ES2015 The Cooler Parts of ES2015 Destructuring

Rose Gao
Rose Gao
5,898 Points

what does mean 'disc' in let {item3 :disc} ?

what does mean 'disc' in let {item3 :disc} ?

1 Answer

Steven Parker
Steven Parker
170,273 Points

In the statement "let { item3: disc } = toybox;", the term "disc" is the name of a new variable that is being created.

It receives the value "frisbee" in the assignment because that's the value associated with the "item3" key in "toybox".