Skip to content
Subhajit Sahu edited this page Nov 20, 2022 · 21 revisions

Get first value.

Similar: head, tail, init, last.


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

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

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


References

Clone this wiki locally