Line Length & Line Breaks

For best readability, programmers often like to avoid code lines longer than 80 characters. If a JavaScript statement does not fit on one line, the best place to break it, is after an operator, or a comma:

HTML file: Displayed by browser:
<!DOCTYPE html>
<html>
<body>

<h1>My Web Page</h1>

<p>The best place to break a code line is after an operator or a comma. </p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
"Hello Dolly.";
</script>

</body>
</html>

My Web Page

The best place to break a code line is after an operator or a comma.


BackTable of ContentsNext