# Variable names when destructuring objects in JavaScript

You can make it so that variable names don't match object key names:

`let obj = { year: 2025, month: 12, day: 31, }; let {year: y, month: m, day: d} = obj; console.log(y); // shows 2025 console.log(m); // shows 12 console.log(d); // shows 31`

The following code writes parts of an object to the corresponding variables:

`let options = { color: 'red', width: 400, height: 500, }; let c = options.color; let w = options.width; let h = options.height;`

Rework this code through destructuring according to the learned theory.

←→
↑
en ru