Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the string type in Typescript

Shulou Source: shulou.com Published: 2022-06-01 03:25:30 09月22日 Update

This article is about how to use the string type in Typescript. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

String

String types, like javascript, can be represented by double quotation marks (") or single quotation marks (')

Let str:string = 'this is ts';str =' test'

As a superset, you can also wrap it with a template string and embed variables through ${}

Let name:string = `Gene`; let sentence:string = `Gene`, my name is ${name} `Thank you for reading! This is the end of this article on "how to use string types in Typescript". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Type character string content quotation marks more article good practical package variable article template look knowledge superset reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Docker Xiaomi Linux vpn