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

Get first value.

Similar: head, tail, init, last.


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

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

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


References

Clone this wiki locally