ES6: spread operator

The spread guy allows us to extract/expand data from an array make our lives 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 a JS Bin with the examples.

More posts