Can use splice but cannot use substring
迷茫
迷茫 2017-07-05 10:48:09
0
4
897

Why do I get an error when using substring for the same array?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(4)
滿天的星座
The

substring() method is used to extract characters between two specified subscripts in a string.

Syntax: stringObject.substring(start,stop)

Cannot be used directly on arrays. Please refer to JavaScript substring() method

伊谢尔伦

substring, as the name suggests, is a function of string.

刘奇

substring is used to operate strings. It is recommended to use slice instead.

淡淡烟草味

splice is the value returned by deletion, oppArr has been changed and becomes empty;
splice(0) is to clear the array; slice(start, end) is to intercept the array and will not change the original array;
substring is to intercept the string Method

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template