return array head | JavaScript

December 24th, 2021 08:11:07 PM

					
const head = arr => (arr && arr.length ? arr[0] : undefined); head([1, 2, 3]); // 1 head([]); // undefined head(null); // undefined head(undefined); // undefined

Featured Posts