access last three element of array javascript code example
Example 1: javascript last element of array
arr.slice(-1)[0]
Example 2: array cut only last 5 element
arr.slice(Math.max(arr.length - 5, 0))
arr.slice(-1)[0]
arr.slice(Math.max(arr.length - 5, 0))