Destructuring assignment

PHOTO EMBED

Tue Oct 04 2022 05:21:41 GMT+0000 (Coordinated Universal Time)

Saved by @johny611 #javascript

let user = {
  name: "John",
  age: 30
};

// loop over keys-and-values
for (let [key, value] of Object.entries(user)) {
  alert(`${key}:${value}`); // name:John, then age:30
}
content_copyCOPY

https://javascript.info/destructuring-assignment