Backslash '\' in console.log() not appearing
I'm trying to use a back slash in console.log() and within <p></p> but it seems that when the page loads, all back slashes are removed.
console.log('\m/ Lets rock. \m/');
m/ Lets rock. m/
How can I prevent it from being removed?
EDIT: Backslash not forward slash. Running this on node.js with express, within the <head> tags of layout.jade. Backslash visible in REPL, but not when running on node in the web browser (Chrome & Firefox).
If m/ Lets rock. m/ is your result, I see forward slashes.
If you mean backslashes, escape them to show that the string wants a literal backslash:
console.log('\\m/ Lets rock. \\m/');
The solution was that the backslashes needed to be double escaped:
console.log('\\\\m/ Lets rock. \\\\m/');
...apparently the backslashes are processed as escaped characters twice (once in the initial string creation, then again for some other purpose).
So the string creation gives us:
'\\m/ Lets rock. \\m/'
...then the subsequent processing results in:
'\m/ Lets rock. \m/'