I saw the following ES6 code and was confused:
class GuitarAmp {
constructor ({ cabinet = 'spruce', distortion = '1', volume = '0' } = {}) {
Object.assign(this, {
cabinet, distortion, volume
});
}
}
What is the second parameter to Object.assign? It's not an object, so what is it? I just noticed it's part of the constructor arguments too, this part:
{ cabinet = 'spruce', distortion = '1', volume = '0' } = {}
I'm unfamiliar with this new syntax so I don't know how to look it up, since I don't know what it's called. Anyone know the term?