Inserts a value to an ordered array.
npm install @extra-array/insert-update.minInserts a value to an ordered array.
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
> This is browserified, minified version of [@extra-array/insert-update].
> It is exported as global variable array_insert.
> CDN: [unpkg], [jsDelivr].
[@extra-array/insert-update]: https://www.npmjs.com/package/@extra-array/insert-update
[unpkg]: https://unpkg.com/@extra-array/insert-update.min
[jsDelivr]: https://cdn.jsdelivr.net/npm/@extra-array/insert-update.min
``javascript`
array.insert$(x, v, [fn]);
// x: an array (updated)
// v: value to insert
// fn: compare function (a, b)
// --> x
`javascript
const array = require('extra-array');
var a = [1, 7, 8, 10];
array.insert$(a, 5);
// [1, 5, 7, 8, 10]
a;
// [1, 5, 7, 8, 10]
var b = ['a', 'K', 'M', 'n'];
array.insert$(b, 'l', (a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
// ['a', 'K', 'l', 'M', 'n'];
b;
// ['a', 'K', 'l', 'M', 'n'];
``