In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use backquotes in es6", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn how to use backquotes in es6 "this article.
The use of es6 backquotes: 1. Define a single-line string; 2. Define a multiline string in which spaces, indents and newlines are retained in the output; 3. Embed variables in the string, and the variable name needs to be written in "${}", for example, "`Hello ${name} `"
The operating environment of this tutorial: windows7 system, ECMAScript version 6, Dell G3 computer.
The template string (template string) is an enhanced version of the string, identified by backquotes (`). It can be used as a normal string, to define a multiline string, or to embed variables in a string.
/ / embed variables var name = "Bob", time = "today" in the string; `Hello ${name}, how are you ${time}? `
If you need to use backquotes in the template string, you should escape with a backslash before.
Var greeting = `\ `Yo\ `World!`
If you use a template string to represent a multiline string, all spaces and indents are retained in the output.
$('# list') .html (`first second`)
If you don't want this line break, you can use the trim method to eliminate it.
$('# list') .html (`first second`.trim ())
To embed a variable in the template string, you need to write the variable name in ${}.
The above is all the content of the article "how to use backquotes in es6". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 282
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.