I dont know why I cannot make a line break in my javascript. Here is the code:
document.write('It\'s ' + n + ',\n'+'SORRY, WE \'RE CLOSED');
Thanks,
I dont know why I cannot make a line break in my javascript. Here is the code:
document.write('It\'s ' + n + ',\n'+'SORRY, WE \'RE CLOSED');
Thanks,
That function will output HTML, so create line breaks by adding <br />, not \n.
document.write('It\'s ' + n + ',<br />SORRY, WE \'RE CLOSED');
However, you shouldn't really be using document.write():
Why is document.write considered a "bad practice"? 
A better option is document.body.innerHTML or document.createElement().
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
 
    
     
    
    Works for me.
<span style="white-space:pre">
<script>
var n = 10;
document.write('It\'s ' + n + ',\n'+'SORRY, WE\'RE CLOSED');
</script>
</span> 
    
    
SORRY, WE \'RE CLOSED');` – raina77ow Sep 24 '15 at 22:07