const a = {En el ejemplo anterior, a la variable
start: { x: 5, y: 6},
end: { x: 6, y: -9 }
};
const { start : { x: startX, y: startY }} = a;
console.log(startX, startY); // 5, 6
start
se le asigna el valor de a.start
, que también es un objeto.
max
de forecast.tomorrow
y asignarlo a maxOfTomorrow
.
maxOfTomorrow
es igual a 84.6
testString: 'assert(getMaxOfTmrw(LOCAL_FORECAST) === 84.6, "maxOfTomorrow
equals 84.6
");'
- text: se utilizó desestructuración anidada
testString: 'getUserInput => assert(getUserInput("index").match(/\{\s*tomorrow\s*:\s*\{\s*max\s*:\s*maxOfTomorrow\s*\}\s*\}\s*=\s*forecast/g),"nested destructuring was used");'
```