Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
@antfu
Latest commit 820dd04 Apr 19, 2022 History
2 contributors

Users who have contributed to this file

@antfu @3imed-jaberi

第一个元素 简单 #array

by Anthony Fu @antfu

接受挑战    English 日本語 한국어

欢迎 PR 改进翻译质量。

实现一个通用First<T>,它接受一个数组T并返回它的第一个元素的类型。

例如:

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

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

返回首页 分享你的解答 查看解答

相关挑战

15・最后一个元素