July 2017
Intermediate to advanced
454 pages
10h 1m
English
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.
Read now
Unlock full access