JavaScript Characters: Backslash (\)

By: Dusty Arlia
Published on Sunday, September 15, 2013, 12:11 PM
Last Updated on Sunday, September 15, 2013, 12:15 PM
Total Updates: 1

The backslash character (\) in JavaScript is used to continue a string literal on the next line. The backslash and the line terminator that follows it are not part of the string literal.

Here is an example:

<script>
document.write("The \
black \
cat.");
</script>

This example outputs:

The black cat.

Comments:

Ad: