destructuring function parameters
Use object destructuring to pass arguments in the function parameters.
class Shape {
createShape(options = {}) {
const { x = 0, y = 0, w = 100, h = 100, c = '#FFF'} = options;
console.log(x,y,w,h,c);
}
}
const shape = new Shape();
shape.createShape({});
copy