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

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

Any

The any data type is a dynamic data type that can hold any value. TypeScript throws compile time errors if you assign a string variable to an integer variable. If you are not sure about what value a variable is going to hold and you would like to opt out of compiler-checking for the type in the assignment, you can use the any data type:

var mixedList:any[] = [1, "I am string", false]; 
mixedList [2] = "no you are not"; 

Here, we used an array of the any type so that it can hold any type, such as numbers, strings, and booleans.

主站蜘蛛池模板: 仙游县| 龙井市| 濮阳县| 吐鲁番市| 夏津县| 铜梁县| 大庆市| 蓝山县| 沽源县| 江源县| 延安市| 万盛区| 遵义市| 达拉特旗| 邵武市| 罗定市| 永吉县| 靖边县| 赤城县| 西吉县| 阳东县| 宁安市| 共和县| 浮梁县| 烟台市| 韶关市| 凤翔县| 华坪县| 油尖旺区| 乌恰县| 阿拉尔市| 偃师市| 永靖县| 奉新县| 大兴区| 毕节市| 久治县| 修文县| 大洼县| 罗山县| 上蔡县|