Create in TypeScript

Find this useful? Support us: Star on GitHub 6
Category: String | Language: TypeScript

In TypeScript, we can create a string using single or double quotes. Here are some examples:

1. Using Single quotes:

let str1: string = 'Hello, World!';

2. Using Double Quotes:

let str2: string = "TypeScript is awesome!";

3. Using Template Literals:

let str3: string = The sum of 2 and 3 is ${2 + 3};

In the third example above, we have used backticks (``) to create a template string, which allows us to embed expressions within the string using ${ } syntax.