get first 6 items from element from array code example
Example 1: return last two values of array in javascript
arr.slice(Math.max(arr.length - 5, 1))
Example 2: array index javascript show only first 2 elements
array.slice(0, n);
arr.slice(Math.max(arr.length - 5, 1))
array.slice(0, n);