javascript splice till end code example
Example 1: array index javascript show only first 2 elements
array.slice(0, n);
Example 2: Array#splice
let arrDeletedItems = array.splice(start[, deleteCount[, item1[, item2[, ...]]]])
array.slice(0, n);
let arrDeletedItems = array.splice(start[, deleteCount[, item1[, item2[, ...]]]])