Two ways to output spaces in Js:
1.Use to output htmltag To solve.
##document.write("
"
"
" "+"A"+"
"+"B");结果: A BCopy after login
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>");
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!