A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/javascript/Array/splice below:

splice · WebPlatform Docs

splice Summary

Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

Syntax
splice( start, deleteCount,  [ item1 [, item2 [, . . . [, itemN ]]]])
start
Required. The zero-based location in the array from which to start removing elements.
deleteCount
Required. The number of elements to remove.
item1, item2,. . ., itemN
Optional. Elements to insert into the array in place of the deleted elements.
Examples

The following code shows how to use the splice method.

var arr = new Array("4", "11", "2", "10", "3", "1");
 arr.splice(2, 2, "21", "31");
 document.write(arr);

 
Remarks

The splice method modifies arrayObj by removing the specified number of elements from position start and inserting new elements. The deleted elements are returned as a new Array object.

See also Specification

[15.4.4.12 Array.prototype.splice (start, deleteCount [ , item1 [ , item2 , … ] ] )] ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011

Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4