// Driver code var arr = [ 11, 89, 23, 7, 98 ]; // use of slice() method var val = arr.slice(2, 4); // printing console.log( arr ); console.log( val );
arr.slice([start[, end]])