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 count is destructured from body.
Thanks for reading 💙
Follow @codedrops.tech for daily posts.
Instagram ● Twitter ● Facebook
Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript
codedrops.tech
Top comments (2)
sweet ecmascript. i find you fluff and beatifull.
except undefined, NaN and null...
Thank you