Home > Web Front-end > JS Tutorial > Use of the slice function - a good application_Basic knowledge

Use of the slice function - a good application_Basic knowledge

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 19:22:07
Original
1484 people have browsed it

Copy code The code is as follows:
Usage of slice function: slice(a, b)
Interception The elements between array a and b form a new array
The intercepted elements are a, a 1, ..., b-1


Method to delete element a to element b in the array It is:
Merge the elements before element a and the elements starting from element b;
function Array.prototype.remove(a, b){
return this.slice(0, a).concat(this. slice((b||a) 1));
}

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template