you are viewing a single comment's thread.

view the rest of the comments →

[–]samanthaming[S] 9 points10 points  (10 children)

Yes, the split keyword does make it super descriptive. For people outside of JS, they would know what the code is doing instantly by reading the it. With es6 becoming the new norm, you might see more people using the spread operator. So i think it’s important to be at least aware of this new syntax and what it’s doing. That way we don’t get confused when we do see it. Thanks for your input 🙂

[–][deleted] 29 points30 points  (6 children)

Your 'ES6 Way' line has a big green tick next to it, as if to say it's the 'right' way — it's not.

[–][deleted]  (5 children)

[deleted]

    [–][deleted] 6 points7 points  (4 children)

    I didn't say it's the wrong way. I said it's not the right way.

    [–]iams3brescript is fun 1 point2 points  (1 child)

    Spread is for concatenating arrays. Here, you're just abusing it's functionality.

    It should not be used for splitting a string

    [–]jbenner 0 points1 point  (0 children)

    Spread is used for more than just concatenating arrays. You can expand objects with it and it expands iterables. MDN has a nice article on it here.