array-middleof

Get middle value of array.

Usage no npm install needed!

<script type="module">
  import arrayMiddleof from 'https://cdn.skypack.dev/array-middleof';
</script>

README

array-middleof

NOTE: array-middleof was renamed to @extra-array/middle. NPM

Get middle value of array.

const middleOf = require('array-middleof');
// middleOf(<array>, [index=0])

middleOf(['m', 'a', 'r', 'a', 'm', 'e', 'l']);
// 'm'
middleOf(['m', 'i', 'l', 'k', 'm', 'a', 'n'], 1);
// 'i'
middleOf(['l', 'u', 'k', 'a'], -1);
// 'a'