7 days of WordPress plugins, themes & templates - for free! Unlimited asset downloads! Start 7-Day Free Trial
  1. Code
  2. Web Development

Quick Tip: Using JSLint

Read Time: 2 mins

It's nothing to be ashamed of: you probably don't write perfect JavaScript the first time. While debugging JavaScript is usually done manually, today's quick tip will teach you how to use JSLint, a tool for catching JavaScript bugs. Think of it as spell-check for JavaScript.


What is JSLint?

Here's Wikipedia's definition of a Lint program:

In computer programming, lint was the name originally given to a particular program that flagged some suspicious and non-portable constructs (likely to be bugs) in C language source code. The term is now applied generically to tools that flag suspicious usage in software written in any computer language.

JSLint is one such program for JavaScript, written by Douglas Crockford (of course). You hand it your JavaScript and it lets you know what to fix.

How do you use it?

After you head over the JSLint Website, the first step is to choose the practices you want to enforce; you can choose the Crockford-recommend settings by clicking the "Good Parts" button.

Then, paste in your JavaScript and hit the JSLint button. If you're code is less than perfect, you'll get a list of errors to fix.

Before JSLint

After JSLint

Where can I learn more about JSLint?

This page explains in depth the concepts behind JSLint. Thanks for reading and watching!

Did you find this post useful?
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.