Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

How to define an array type in typescript

// If we have an array, we can define its type in TypeScript by using the notation type[].

let arrayType:string[] = [ 'hello', 'there' ]

// Similarly, an array of numbers could be defined like this:

let myNumbers:number[] = [ 1, 2, 3, 4 ];
Source by devdojo.com #
 
PREVIOUS NEXT
Tagged: #How #define #array #type #typescript
ADD COMMENT
Topic
Name
1+9 =