2

I am new to JavaScript. I was reading about a neat ES6 feature, destructuring assignment. In the section "Setting a function parameter's default value - ES6 version" it has the following example:

function drawES6Chart({size = 'big', cords = { x: 0, y: 0 }, radius = 25} = {}) {
//------------------------------------------------------ what is this for? ^
}

drawES6Chart({
    cords: { x: 18, y: 30 },
    radius: 30
});

When destructuring the parameters of drawES6Chart() what is the purpose of = {}?

Amous
  • 534
  • 5
  • 18

0 Answers0