O'Reilly logo

Web Programming with HTML5, CSS, and JavaScript by Dean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.17 Comments and Coding Conventions

In prior chapters, you learned about various coding conventions for HTML and CSS. Earlier in this chapter, you learned a few coding conventions for JavaScript, such as needing to use descriptive variable names. In this section, you’ll get a deeper immersion into JavaScript coding conventions. Remember—it’s important to follow coding conventions so your code is understandable, robust, and easy to maintain.

Comments

Let’s start with a very important coding convention—use appropriate comments. JavaScript has two types of comments: one type for short comments and one type for longer comments. The syntax for short comments is simply two forward slashes (//) at the left of the descriptive text. Here’s an example: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required