njs
njs copied to clipboard
add the spread operator: object literals
> console.log({ a: 1, ...{ a: 2, b: 2}, b: 3 })
{ a: 2, b: 3 }
undefined
> console.log({ ...'it is funny' })
{ '0': 'i',
'1': 't',
'2': ' ',
'3': 'i',
'4': 's',
'5': ' ',
'6': 'f',
'7': 'u',
'8': 'n',
'9': 'n',
'10': 'y' }
undefined
> console.log({ ...[1,2,3] })
{ '0': 1, '1': 2, '2': 3 }
https://github.com/tc39/proposal-object-rest-spread/blob/master/Spread.md