slice array from N to last element

前端 未结 7 2022
你的背包
你的背包 2020-12-29 01:11

How to make this transformation?

[\"a\",\"b\",\"c\",\"d\",\"e\"] // => [\"c\", \"d\", \"e\"]

I was thinking that slice can

7条回答
  •  伪装坚强ぢ
    2020-12-29 01:47

    Don't use the second argument:

    Array.slice(2);
    

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice

    If end is omitted, slice extracts to the end of the sequence.

提交回复
热议问题