If your JavaScript editor uses different colours to identify different parts of your JavaScript then you will have a much easier time spotting some errors in your code before you even get to the point of trying to run it.
Perhaps the most useful of the colour coding that is normally done when your editor is able to specifically mark up your JavaScript using different colours is to use one colour specifically for all the content of text strings. This enables you to easily confirm that you remembered to use the appropriate quote mark to end the text string in the right place. As the single and double quote marks that you place around text strings are relatively small characters, without the colour coding it can be very easy to overlook that you have omitted one, or have used the wrong one. Depending on how sophisticated the colour coding functionality is it may or may not recognise when you have escaped a quote within the text string and may mess up the colour coding of the rest of that line but you should still be able to tell whether you have the closing quote mark in place even when it does that.
The editor should be using a second colour for all the JavaScript reserved words. This is useful in several ways.One thing it achieves is to ensure that you do not make any errors in typing reserved words because if you don't type it correctly then it will not be displayed in the correct colour. Also since JavaScript has several reserved words that are not currently used but which are reserved for future use not everyone has all of the reserved words memorised and may accidentally try to use one of those reserved for future use words for some other purpose. That the word is displayed in the appropriate colour to indicate it is a reserved word will clearly show that it is a reserved word and can't be used for what you intended.
A third colour is usually applied to all the objects that are normally built into JavaScript. This serves a similar purpose to the colour coding of reserved words in that you should not normally be trying to redefine the meanings of these objects within your own code as that can break the expected functioning of other code.
Your editor might use a fourth colour for special symbols. In many cases the spacial symbols are smaller characters than regular letters and numbers and they are also often easy to overlook. By placing them in a different colour they hopefully stand out a little more from the surrounding content so that you can tell more easily whether they are in the right place. You are far more likely to spot that an essential semi-colon is missing if it is normally displayed in a different colour to the adjacent text. That there is nothing there of the expected colour is easier to spot than looking for the semi-colon itself (which often you will somehow just assume is there).
By separating out these types of content into different colours your editor will make it much easier for you to visually spot whether your code is correctly written long before you reach the stage of trying to run it. You should be able to spot many of the simle to make but hard to spot (without colour coding) errors just about as soon as you make them rather than getting to the stage where you actually try to run your testing.
Depending on where you are writing your JavaScript you may not have access to a colour coding editor (for example if you write JavaScript for your employer and the editor they supply for you to write it in doesn't offer colour coding). This should be a fairly rare situation since most decent editors provide this functionality but even where you don't have such an editor you can still get all of the advantages of checking your code using colour coding. My JavaScript Formatter can take any JavaScript code you have written and apply colour coding to it for you. Not only does it apply all of the colour coding described above but it also reformats the code for you so that all of the statements within a particular block have the same indentation. This provides you with additional ways to visually check that your code does not contain errors since if you have omitted to close a block of code then all of the subsequent code will then be incorrectly indented.
