Home > Web Front-end > JS Tutorial > A simple way to implement multi-line strings in javascript_javascript skills

A simple way to implement multi-line strings in javascript_javascript skills

WBOY
Release: 2016-05-16 16:01:12
Original
1230 people have browsed it

Usually use string or [].join('')

A colleague recommended this format

ExceptionDivHtml="<div class='gameItems'>\
 <div class='kreds_top_L'>\
  <span style='padding:0 10px;'><b>Current Balance:</b><font> </font> Credits</span>\
 </div>\
</div>";
Copy after login

I found that it is supported in the browser, and the related writing method is also very simple.

There is a problem, that is, when the string is compressed, the preceding spaces are also in the string, so it will not be compressed.

So in projects that do not require compression, or if the compression requirements are not so strict, you can indeed use the above method, and the code will look more structured and simple

The above is the entire content of this article, I hope you all like it.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template