Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use object spread syntax in chrome dev tools

I started using object spread syntax to safely make a copy of the object while following immutability principles.

I want to use it in chrome developer console - how to do this:

enter image description here

like image 972
Probosckie Avatar asked Feb 06 '17 06:02

Probosckie


2 Answers

You can enable the javascript experiments flag on: chrome://flags/#enable-javascript-harmony to enable web pages to use experimental JavaScript features including the Rest / Spread.

like image 150
Washington Braga Avatar answered Oct 11 '22 14:10

Washington Braga


Object spread is available in all modern browsers (since Chrome 60) and can be used like this:

{...{foo: 'bar'}, john: 'doe'}

And will return: {foo: "bar", john: "doe"}

like image 5
sqren Avatar answered Oct 11 '22 15:10

sqren