Home >Web Front-end >JS Tutorial >What are the two ways of outputting spaces in JavaScript?
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 ='white-space:pre;'>+" 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!