src/utils/array/indexFromEnd.js
/**
* Returns the element in an array at a particular index from the end
* @param {Array.<T>} array Array to iterate over to find the item
* @param {number} placesFromEnd Number of places from the end of the array to find
* the item to return
* @returns {T} The item found in the array at the particular index
* @template T
*/
function indexFromEnd(array, placesFromEnd) {
return array[array.length - (placesFromEnd + 1)];
}
export default indexFromEnd;