filmov
tv
JavaScript function to get the last 'n' elements of the array | JavaScript

Показать описание
Write a JavaScript function to get the last 'n' elements of the array. If array has 6 elements and if user gives 4, it has to return last 4 elements. If user gives ‘n’ which is greater than the number of elements in the array, then it should return all elements.