js get last 4 elements of array code example
Example 1: return last two values of array in javascript
arr.slice(Math.max(arr.length - 5, 1))
Example 2: array cut only last 5 element
arr.slice(Math.max(arr.length - 5, 0))
arr.slice(Math.max(arr.length - 5, 1))
arr.slice(Math.max(arr.length - 5, 0))