Variables and default values in JavaScript

You can also change the variable names to your own while setting the default values:

javascriptlet obj = {
  month: 12,
  day:   31,
};

let {year:y = 2025, month, day} = obj;

console.log(y);     // shows 2025
console.log(month); // shows 1
console.log(day);   // shows 31
Задание 1

In the following code, parts of the object are written to the corresponding variables:

javascriptlet options = {
  width:  400,
  height: 500,
};

let c;
if (options.c !== undefined) {
  c = options.color;
} else {
  c = 'black';
}

let w = options.width;
let h = options.height;

Rework this code through destructuring according to the learned theory.