Destructuring nested object
Task: Destructuring response.body.count.
const response = {
msg: "success",
body: {
count: 5,
data: ["File 1", "File 2"],
},
};
const {
body: { count },
} = response;
console.log(count); // 5
Here, first body is destructured, then ...
codedrops.hashnode.dev1 min read