Using the string type

Like all other programming languages, TypeScript also uses string datatypes to represent textual data. You can use single quotes (' and ') or double quotes (" and ") to surround the string value:

let firstName: string = "Kunal";       // using double quotes 
let lastName: string = 'Chowdhury';    // using single quotes 

TypeScript also supports templated strings, where you can span a string to use multiple lines and print values of embedded expressions in the form of ${expression}. The templated strings are surrounded by backquote/backtick (` and `) and can be written as follows:

let authorName: string = "Kunal Chowdhury"; 
let blogURL: string = "https://www.kunal-chowdhury.com";  
let message: string = `Hi, my name is ${authorName}. 
  
I do blog at ${blogURL}. Don't forget to visit it.`;

You can use templated strings in your code to properly format the string using expression values.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.224.197