Fork me on GitHub

JSLint Error Explanations

JSLint will hurt your feelings. It's time to make them better!


Nested comment

When do I get this error?

JSLint will throw the "Nested comment" error when it encounters the characters /* inside a multiline comment. Here's an example:

Why do I get this error?

This error is raised to highlight a potentially dangerous piece of code. While it is valid to include the /* string in a multiline comment, it is not valid to include the */ string. If you were to do so, everything following the first */ will be parsed as if it is not part of the comment. Here's an example (notice the syntax highlighting which demonstrates the error):

Like it does for many of its errors, JSLint takes the safe approach and forbids the use of the string /* anywhere in a multiline comment.


James Allardice

This article was written by James Allardice, an enthusiastic young JavaScript developer at Global Personals (we're looking for developers so please apply). He is passionate about writing clean, maintainable JavaScript and uses JSHint every day to help achieve this.

You can follow him on Twitter, fork him on GitHub and find him on Google+.


Proceeds generated by this site are donated to help advance other open source projects



comments powered by Disqus