2020-07-29 14:04:44 +08:00
..
2020-07-28 18:09:56 +08:00
2020-07-28 18:09:56 +08:00
2020-07-29 14:04:44 +08:00
2020-07-28 18:09:56 +08:00
2020-07-28 18:09:56 +08:00

Head of Array easy #array #4.0

by Anthony Fu @antfu

Take the Challenge

Implement a generic Head<T> that takes an Array T and returns it's first element's type.

For example

type arr1 = ['a', 'b', 'c']
type arr2 = [3, 2, 1]

type head1 = Head<arr1> // expected to be 'a'
type head2 = Head<arr2> // expected to be 3

Back Check out Solutions Share your Solutions