Destructuring object by passing it as parameter to the function

PHOTO EMBED

Tue Jul 12 2022 09:23:55 GMT+0000 (Coordinated Universal Time)

Saved by @Harsh_S #array #object #destructure #parameter #arrowfunction

const profileUpdate = (profileData) => {
  const { name, age, nationality, location } = profileData;

}
//This effectively destructures the object sent into the function. This can also be done in-place:

const profileUpdate = ({ name, age, nationality, location }) => {

}
//When profileData is passed to the above function, the values are destructured from the function parameter for use within the function.
content_copyCOPY

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters