dropRightn
DropRightn is a function commonly found in functional programming languages and libraries, such as Lodash in JavaScript. It is used to create a new array by removing a specified number of elements from the end of an existing array. The function takes two arguments: the array to be modified and the number of elements to remove from the end. If the number of elements to remove is greater than the length of the array, the function returns an empty array. If the number of elements to remove is zero or negative, the function returns a copy of the original array. DropRightn is a non-destructive operation, meaning it does not modify the original array but instead returns a new array with the specified elements removed. This function is particularly useful in scenarios where you need to manipulate arrays without altering the original data, such as in data processing or transformation tasks.