[quickjs-devel] Re: Feature request: spread syntax for object literals

  • From: Saúl Ibarra Corretgé <s@xxxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Tue, 6 Aug 2019 09:30:09 +0200

On 05/08/2019 23:49, Alexander Rodin wrote:

It would be nice to have spread syntax for object literals [1] in QuickJS:

let obj = {a: 3, b: 4};
let objClone = { ...obj };

It is in the standard since ECMAScript 2018 [2].

References:

[1] 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax
[2] http://www.ecma-international.org/ecma-262/9.0/#sec-object-initializer
<http://www.ecma-international.org/ecma-262/10.0/#sec-object-initializer>

Thanks,
Alexander

This already works, AFAICT:

QuickJS - Type "\h" for help
qjs > let obj = {a: 3, b: 4};
undefined
qjs > let objClone = { ...obj };
undefined
qjs > objClone
{ a: 3, b: 4 }
qjs >

-- 
Saúl

Other related posts: