Given this:
var metadata = {
title: 'Scratchpad',
translations: [
{
title: 'JavaScript-Umgebung'
}
]
};
const output = ({
title: englishTitle,
translations: [{
title: localeTitle
}]
}) => (
console.log(englishTitle), // "Scratchpad"
console.log(localeTitle) // "JavaScript-Umgebung"
)
output(metadata);
Now translations
is undefined:
console.log(JSON.stringify(translations)) // ❌ "undefined"
Question: Is there a way to create a variable translations
within the params destructure expressions (e.g. within the function param parenthesis)