var a = '
\ ^___^
\ (ooo)\_______
(___)\ )\/\
||----w |
|| ||
'
document.write(a);
How do they show that variable as it really is, and not linearly?
var a = '
\ ^___^
\ (ooo)\_______
(___)\ )\/\
||----w |
|| ||
'
document.write(a);
How do they show that variable as it really is, and not linearly?
String.raw () is a postprocessed tag function for text string templates, available in ECMAScript 2015 (ES6). It is used to obtain the raw string ( raw ) of the template, without interpreting it. It is analogous to a string verbatim in JavaScript. See compatibility .
var literal = String.raw'Tex\to
No \ "interpretado" \ .
Incluso \n no es un salto de línea';
Also, when it is printed in the browser, it would also be interpreted, so it can be printed on a <pre>
tag.
var a = String.raw'
\ ^___^
\ (ooo)\_______
(___)\ )\/\
||----w |
|| ||
';
document.write('<pre>' + a + '</pre>');
You will have to concatenate the lines with the operator + and give the blank spaces you need, when you declare the variable.
var a =
'\ ^___^' +
' \ (ooo)\_______' +
' (___)\ )\/\' +
' ||----w |' +
' || ||';