Desestruturação de objetos parâmetros de funções em JavaScript

De maneira análoga, é possível desestruturar parâmetros-objetos:

javascriptfunction func({year, month, day}) {
  console.log(year);  // exibirá 2025
  console.log(month); // exibirá 12
  console.log(day);   // exibirá 31
}

func({year: 2025, month: 12, day: 31,});
Задание 1

Refatore o seguinte código usando desestruturação de acordo com a teoria estudada:

javascriptfunction func(options) {
  let color  = options.color;
  let width  = options.width;
  let height = options.height;
}

func( {color: 'red', width: 400, height: 500} );
Задание 2

Refatore o seguinte código usando desestruturação de acordo com a teoria estudada:

javascriptfunction func(options) {
  let width  = options.width;
  let height = options.height;
  
  let color;
  if (options.color !== undefined) {
    color = options.color;
  } else {
    color = 'black';
  }
}

func( {color: 'red', width: 400, height: 500} );