Skip to content
Subhajit Sahu edited this page May 3, 2023 · 20 revisions

Get last value.

Similar: head, tail, init, last.


function last(x, vd?)
// x:  an array
// vd: default value
const xarray = require('extra-array');

xarray.last([1, 2, 3]);
// → 3

xarray.last([], -1);
// → -1


References

Clone this wiki locally