TypeScript:数组

数组

详见 JavaScript教程:Array 数组

存储 相同类型 的数据,按一定的 顺序 排列

声明

方式一(推荐)

使用方括号声明

let 变量名 : 类型[] = []

例子

let students : string[] = ["李雷","韩梅梅","lucy","lili"]

console.log( students )

方式二

使用泛型语法

let 变量名 : Array<类型> = []

例子

let students : Array<string> = ["李雷","韩梅梅","lucy","lili"]

console.log( students )

原文出处:/show_1IX5LF152HJl.html