spread syntax vs slice method

前端 未结 5 2205
终归单人心
终归单人心 2020-12-29 07:23

I was trying to understand what is the difference between spread syntax vs slice method in the following approach.

suppose I want to make an actual copy of an array,

5条回答
  •  一向
    一向 (楼主)
    2020-12-29 08:13

    Performance will depend on the engine where its' running. And as with most Javscript code, it will probably be running in various different engines. So, use whatever feels aesthetically better. For me that's spread.

    ... is sheer beauty.

    If you decide to go with slice, skip the 0, just say .slice().

提交回复
热议问题