
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Optimal JavaScript Line Length Guidelines
Try to keep the length of lines less than 80 characters. This would make the code easier to read. Best practice is to move to next line using break if JavaScript statements aren’t fitting in a single line.
In addition, move to next line only after a comma or operator. For example, you can add statement like this, with a break after operator,
function display() { var a = ""; a = a + isNaN(6234) + ": 6234<br>"; a = a + isNaN(-52.1) + ": -52.1<br>"; a = a + isNaN('') + ": ''<br>"; document.getElementById("test").innerHTML = a; }
Advertisements