From the course: JavaScript: Best Practices for Code Formatting

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Standardize line length

Standardize line length - JavaScript Tutorial

From the course: JavaScript: Best Practices for Code Formatting

Start my 1-month free trial

Standardize line length

- [Instructor] Aside from automatic semicolon insertion, white space is not significant in JavaScript. As a result, you can theoretically write lines of code of any length. And indeed one of the ways that Minification reduces character count is by reducing code to a single line. However, when formatting code for human usability, limiting line length is a widely adopted practice. Shorter lines enable you to fully view each line without wrapping or scrolling. In addition, breaking up a long statement across multiple lines when combined with indentation, can help you parse what the entire statement is doing as well as any steps involved in the process. Code is generally displayed in a fixed width font, meaning that each character takes up the same amount of space on the line. For this reason it's common to measure line lengths in characters. Common line lengths include 80 or 100 characters. In my app.js file, a few lines look…

Contents