Top "Spread-syntax" questions

Please use this tag to refer to "..." in JavaScript.

What is the cleanest way to remove an element from an immutable array in JS?

I need to remove an element from an array that is a state of a React Component. Which means that …

javascript arrays reactjs immutability spread-syntax
Why is my map() with spread syntax not working?

I'm really not seeing where this is going wrong. I've seen posts of this particular example from O'Reilly's Learning React, …

javascript dictionary spread-syntax
Difference between using a spread syntax (...) and push.apply, when dealing with arrays

I have two arrays, const pets = ["dog", "cat", "hamster"] const wishlist = ["bird", "snake"] I want to append wishlist to pets, …

javascript arrays ecmascript-6 apply spread-syntax
spread operator converting objects to array

I'm trying to convert a data structure like this: data = { 0:{A:a}, 1:{B:b}, 2:{C:c}, } into a structure like …

javascript arrays object ecmascript-6 spread-syntax
Is there an Object spread syntax in python 2.7x like in Javascript?

How can I spread an objects/dict(?) properties and into a new object/dict? Simple Javascript: const obj = {x: '2…

javascript python object spread-syntax
Iterate over array of objects and change one property in each object

I find myself presented with this pattern quite a bit. I have an array of objects that I get back …

javascript ecmascript-6 spread-syntax
Usage of rest parameter and spread operator in javascript

What's the usage of rest parameter that will be added in ECMAScript 6? For example, in ECMAScript 5 you can do the …

javascript ecmascript-6 spread-syntax rest-parameters
How to return a spread operator in a map arrow function in one line

What I need to do is map over an Array and set a value to false on all of the …

javascript arrays ecmascript-6 spread-syntax
How exactly does the spread syntax (...) work with mapGetters?

Whenever you want to use a computed getter with the mapGetter helper from Vuex you would use it like so: ...…

javascript ecmascript-6 vue.js vuex spread-syntax
Spreading undefined in array vs object

Why does spreading undefined in an object return an empty object? {...undefined} // equals {}: And Why does spreading undefined in an …

javascript ecmascript-6 spread-syntax