0% found this document useful (0 votes)
7 views2 pages

TypeScript String

This document provides a tutorial on the TypeScript string data type, highlighting the use of double quotes, single quotes, and backticks for string literals. It explains the concept of template strings for multi-line strings and string interpolation. Examples illustrate how to define strings and embed variables within them.

Uploaded by

Aayush Sinha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

TypeScript String

This document provides a tutorial on the TypeScript string data type, highlighting the use of double quotes, single quotes, and backticks for string literals. It explains the concept of template strings for multi-line strings and string interpolation. Examples illustrate how to define strings and embed variables within them.

Uploaded by

Aayush Sinha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

27/02/2026, 17:09 TypeScript String

TypeScript String
If this site saves you hours of work,
please
whitelist it in your ad blocker ? to
support us ?
in creating more helpful and free content
in the future.
Summary: in this tutorial, you’ll learn about the TypeScript string data type.
Like JavaScript, TypeScript uses double quotes ( " ) or single quotes ( ' ) to surround string
literals:
let firstName: string = 'John';
let title: string = "Web Developer";

TypeScript also supports template strings that use the backtick (`) to surround characters.
The template strings allow you to create multi-line strings and provide string interpolation
features.
The following example shows how to create a multi-line string using the backtick (`):
let description = `This TypeScript string can
span multiple
lines
`;

String interpolations allow you to embed the variables into the string like this:
let firstName: string = `John`;
let title: string = `Web Developer`;
let profile: string = `I'm ${firstName}.
I'm a ${title}`;
[Link] 1/2
27/02/2026, 17:09 TypeScript String

[Link](profile);

Output:
I'm John.
I'm a Web Developer.

Summary
In TypeScript, all strings get the string type.
Like JavaScript, TypeScript uses double quotes ( " ), single quotes ( ' ), and
backtick (`) to surround string literals.

[Link] 2/2

You might also like