I am trying to learn Destructuring in Javascript introduced with ES6. While following a medium post I came across this code :
function displaySummary({ name, scores: { maths = 0, english = 0, science = 0 } }) {
console.log('Hello, ' + name);
console.log('Your Maths score is ' + maths);
console.log('Your English score is ' + english);
console.log('Your Science score is ' + science);
}
I know this is a way of Destructuring but how do i pass arguments while calling this function? I have tried calling it like
displaySummary({'John Doe',{1,2,3}});
But got an error something like Uncaught SyntaxError: Unexpected Token ','
How do we do this?