# How important is backslash in breaking a string in JavaScript?

JavascriptObject Oriented ProgrammingFront End Technology

Backslash(\) is very important in breaking a string in javascript. Without backslash when a string is breached, it can't be read by javascript there by no output is produced

In the following example since a backslash is not used while breaking a string, no output is displayed.

## Example

Live Demo

<html>
<body>
<p id="backslash"></p>
<script>
document.getElementById("backslash").innerHTML = "Javascript is   // string breached here
not java!";
</script>
</body>
</html>

In case if the backslash is used then javascript tries to read the entire string and display it in the output as shown below.

## Example

Live Demo

<html>
<body>
<p id="backslash"></p>
<script>
document.getElementById("backslash").innerHTML = "Javascript is \
not java!";
</script>
</body>
</html>

## Output

Javascript is not java!
Published on 25-Jun-2019 13:11:39