let fibonacci: number[] = [1, 1, 2, 3, 5];
//数组的项中不允许出现其他的类型:
// let fibonacci: number[] = [1, '1', 2, 3, 5]; 报错
//一个比较常见的做法是,用 any 表示数组中允许出现任意类型:
let list: any[] = ['xcatliu', 25, { website: 'http://xcatliu.com' }];
ts 数组的类型
猜你喜欢
转载自blog.csdn.net/weixin_38404899/article/details/103719069
今日推荐
周排行