head - 获取数组的第一个元素

优质
小牛编辑
120浏览
2023-12-01

返回数组的第一个元素。

使用 arr[0] 返回传递数组的第一个元素。

const head = arr => arr[0];
head([1, 2, 3]); // 1