Is there a way to use the character '\' inside a string and have it be read as text?
Can't seem to find an answer for this anywhere.
Is there a way to use the character '\' inside a string and have it be read as text?
Can't seem to find an answer for this anywhere.
Backslash(\
) is an escape character, & to use backslash you need to escape it using another backslash.\\
will output only single \
document.getElementById("demo").innerHTML = "hello\\"
<div id="demo"></div>
just use double backslash(\\) . As single backslash (\)is a reserve word in JavaScript for escape character.