pub static splice: SpliceInternalTypeExpand description
Inserts a value or an array of values into an existing array. The first parameter specifies the initial array to be modified, and the second parameter defines the data to be inserted. The third parameter is an index value which specifies the array position from which to insert data. (Remember that array index numbering starts at zero, so the first position is 0, the second position is 1, and so on.)
Examples
function setup() {
let myArray = [0, 1, 2, 3, 4];
let insArray = ['A', 'B', 'C'];
print(myArray); // [0, 1, 2, 3, 4]
print(insArray); // ['A','B','C']
splice(myArray, insArray, 3);
print(myArray); // [0,1,2,'A','B','C',3,4]
}Parameters
list Array to splice into
value value to be spliced in
position in the array from which to insert data