last 5 of an array code example Example: return last two values of array in javascript arr.slice(Math.max(arr.length - 5, 1))