Add double quotes in string in typescript

To add double quotes in the string in typescript, use double quotes both side with the + operator it will concatenate the string and return a new string with double quotes like below example.

let str: string = "infinitbility";

// add double quotes
str = '"' + str + '"';
console.log(str) // 👉️ '"infinitbility"'

Add double quotes at the beginning of string in typescript

To add double quotes at the beginning of string in typescript, use double quotes at starting of the string with the + operator it will concatenate the string and return a new string with double quotes like below example.

let str: string = "infinitbility";

// add double quotes
str = '"' + str;
console.log(str) // 👉️ '"infinitbility'

To show space at the beginning of the string you should put a double quotes string before the + operator, like in the above example.

Add double quotes at the end of the string in typescript

To add double quotes at the end of string in typescript, use the + operator with a double quotes string it will concatenate the string and return a new string with space.

let str: string = "infinitbility";

// add double quotes
str =  str + '"';
console.log(str) // 👉️ 'infinitbility"'

To show add double quotes at the end of string you should put a double quotes string after the + operator, like in the above example.

I hope it helps you, All the best 👍.