Colorful fireworks in a dark sky

ES6: spread operator

The spread guy allow us extract/expand data from an array make our lifes easier. Confused? I guess I could not explain. Go to practice. Imagine the following arrays:

If we had to add the new fighters to the main array, we could try something like that:

The data is there, but not in the way that we want. So we need to manipulate it before:

The operator spread arrives making magic and leaving everything beautiful.

Here you can find an JS Bin with the examples.

See all posts...