0 votes
in JavaScript by
What is destructuring aliases in Javascript?

1 Answer

0 votes
by

Sometimes you would like to have a destructured variable with a different name than the property name. In that case, you'll use a : newName to specify a name for the variable. This process is called destructuring aliases.

const obj = { x: 1 };
// Grabs obj.x as as { otherName }
const { x: otherName } = obj;
...