Get last X elements from JavaScript array

const last3 = arr.slice(-3)