Home  >  Article  >  Web Front-end  >  What are the two ways of outputting spaces in JavaScript?

What are the two ways of outputting spaces in JavaScript?

一个新手
一个新手Original
2017-10-11 09:38:011975browse

Two ways to output spaces in Js:

1.Use to output htmltag To solve.        

##document.write("a36e93482837a0427bd04c229bc70515 

" 54bdf357c58b8a65c66d7c19c8e4d114189af69e35c0eb57924608796a15a78f 
" 189af69e35c0eb57924608796a15a78f 
" 54bdf357c58b8a65c66d7c19c8e4d11454bdf357c58b8a65c66d7c19c8e4d114"+"A"+"0c668c0c0c1c0a88fb4c1b9347de2a81 
189af69e35c0eb57924608796a15a78f 
54bdf357c58b8a65c66d7c19c8e4d11454bdf357c58b8a65c66d7c19c8e4d114"+"B");
结果:          A         B


2.

Add the "white-space:pre;

" style attribute when outputting. This style means "whitespace will be retained by the browser".

document.write("<span style =&#39;white-space:pre;&#39;>+"       A        B"+"</span>");
rrree

The above is the detailed content of What are the two ways of outputting spaces in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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