top | item 31307944

(no title)

ludamad | 3 years ago

I'm not sure I understand the point about kwargs. That's a feature specific to python keyword params - what's the JS equivalent with ... here?

discuss

order

brundolf|3 years ago

They're probably talking about the fact that it also works on objects (JS equivalent of dicts)

jakear|3 years ago

Yes, {**{'hello':1}, **{'world':2}} === {...{hello:1}, ...{world:2}}

The name "kwargs" is unimportant, I'm referring to the ** operator itself.

Edit: worth mentioning this applies in the consuming named arguments sense as well: ({arg1, arg2, ...rest}) => {}