Skip to content

Richienb/last-item-index

Repository files navigation

last-item-index Travis CI Build Status

Get the index of the last item in an array.

NPM Badge

Install

npm install last-item-index

Usage

const lastItemIndex = require("last-item-index")

lastItemIndex([1, 2, 3]);
//=> 2

lastItemIndex([]);
//=> undefined

API

lastItemIndex(array)

array

Type: array

The array to get the index for.