views:

33

answers:

2

I've tested my JavaScript in several browsers and it all works fine. However when I run it through JSLint, there are a few (minor) errors it picks up.

If the code works, is it important to fix these?

+1  A: 

I'd say yes. If JSLint is telling you something is wrong, best to act on it.

Personally, knowing there were errors would nag me. I wouldn't be deterred by the fact that the code "works". I couldn't be certain that these "minor" errors - your judgment - would not cause a problem in the future.

duffymo
+3  A: 

If the code works, then they probably aren't errors. JSLint is a Lint, not a validator and a very large part of what it does is enforce Douglas Crockford's ideas about best practices.

That said, they are mostly pretty good best practices, and following them is usually a good idea.

David Dorward
+1. I disagree with Crockford on quite a few things but his ideas are generally sound.
Tim Down
Yup. And having a well thought out reason for such a disagreement is an excellent reason for ignoring a warning from JSLint. If, OTOH, someone doesn't know why they want to ignore a warning, it is better to follow the advice until you can get more information and form either agreement or disagreement.
David Dorward