last-item

Get the last item in an array or other iterable.

Usage no npm install needed!

<script type="module">
  import lastItem from 'https://cdn.skypack.dev/last-item';
</script>

README

last-item

Get the last item in an array or other iterable.

Install

npm install last-item

Usage

import lastItem from 'last-item';

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

API

lastItem(iterable)

iterable

Type: iterable

The array or other iterable to get the last item for.