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

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.

主站蜘蛛池模板: 汶川县| 黄平县| 乌拉特后旗| 南昌市| 京山县| 龙门县| 彭泽县| 青阳县| 江陵县| 临泉县| 旬邑县| 独山县| 措美县| 内黄县| 深州市| 疏勒县| 阿拉善右旗| 乐昌市| 南宁市| 连南| 广饶县| 富蕴县| 江川县| 綦江县| 休宁县| 积石山| 新丰县| 微博| 郸城县| 大庆市| 房山区| 余江县| 辉南县| 宜城市| 拉萨市| 万山特区| 呼伦贝尔市| 金塔县| 黑山县| 永州市| 苍溪县|