官术网_书友最值得收藏!

  • Expert Angular
  • Mathieu Nayrolles Rajesh Gunasundaram Sridhar Rao
  • 110字
  • 2021-07-15 17:05:30

Array

The array data type is meant to hold a collection of values of specific types. In TypeScript, we can define arrays in two ways, which are as follows:

var even:number[] = [2, 4, 6, 8, 10]; 

This statement declares an array variable of the number type using square brackets ([]) after the data type number, and it is assigned with a series of even numbers from 2 to 10. The second way to define array is as follows:

var even:Array<number> = [2, 4, 6, 8, 10]; 

This statement uses the generic array type, which uses the Array keyword followed by angle brackets (<>) that wrap the number data type.

主站蜘蛛池模板: 彭水| 崇左市| 麻阳| 海晏县| 长阳| 玉树县| 遵化市| 阿巴嘎旗| 中牟县| 漳平市| 响水县| 芜湖市| 松溪县| 滨海县| 长宁区| 保定市| 美姑县| 增城市| 商河县| 清河县| 麻江县| 建湖县| 内江市| 罗山县| 和顺县| 镇安县| 儋州市| 新和县| 太仆寺旗| 太白县| 遂平县| 泊头市| 景德镇市| 甘德县| 娄烦县| 政和县| 湖北省| 垫江县| 拉萨市| 罗甸县| 克拉玛依市|