Q:

array cut only last 5 element

arr.slice(Math.max(arr.length - 5, 0))
0

New to Communities?

Join the community