How to Declare an Array of Strings in TypeScript ? Last Updated : 16 Jul, 2024 Comments Improve Suggest changes Like Article Like Report Arrays are fundamental data structures in TypeScript, enabling developers to manage collections of elements efficiently. Below are the approaches to declare an Array of strings in TypeScript:Table of ContentSquare Brackets NotationArray ConstructorSquare Brackets NotationUsing square brackets notation is the most common and straightforward method to declare an array of strings in TypeScript. It involves enclosing the string type within square brackets.Syntax:let myArray: string[] = ["string1", "string2", "string3"];Example: In this example, we declare an array named fruits containing three strings representing different types of fruits. TypeScript let fruits: string[] = ["Apple", "Banana", "Orange"]; console.log(fruits); Output["Apple", "Banana", "Orange"]Array ConstructorAnother way to declare an array of strings in TypeScript is by using the Array constructor. You can specify the type of elements the array will contain by passing it as an argument to the constructor.Syntax:let myArray: Array<string> = new Array<string>("string1", "string2", "string3");Example: In this example, we use the Array constructor to create an array named colors containing different color names as strings. TypeScript let colors: Array<string> = new Array<string>("Red", "Green", "Blue"); console.log(colors); Output["Red", "Green", "Blue"] Comment More infoAdvertise with us Next Article How to Declare an Array of Strings in TypeScript ? N nikunj_sonigara Follow Improve Article Tags : JavaScript Web Technologies TypeScript Similar Reads How to Declare an Empty Array in TypeScript? TypeScript provides a robust type system that allows you to define and manage data structures more effectively than in plain JavaScript. One common task is declaring empty arrays with specific types, ensuring that your array holds only values of the intended type. These are the following ways to dec 2 min read How to Declare a Fixed Length Array in TypeScript ? To declare a Fixed-length Array in TypeScript you can use a Tuple. Tuple types allow you to specify the types for each element in the array and, importantly, define a fixed number of elements in a specific order. In this article, we are going to learn how to declare a fixed-length array in TypeScrip 3 min read How to Clone an Array in TypeScript ? A cloned array is an array that contains all the items or elements contained by an already existing array in the same order. A cloned array does not affect the original array. If there is any change made in the cloned array it will not change that item in the original array. We can use the following 5 min read How to Format Strings in TypeScript ? Formatting strings in TypeScript involves combining and structuring text to produce clear and readable output. This practice is essential for creating dynamic and user-friendly applications, as it allows developers to seamlessly integrate variables and expressions into strings, enhancing the overall 3 min read How to Convert a Set to an Array in TypeScript ? A Set in TypeScript is used to create a particular type of list that does not contain duplicate elements. If any element is repeated more than once it will automatically remove the duplicate existence and consider it only once in the list. In this article, we will convert these types of lists into a 5 min read Like