Complementing the @Caffé response:
In the specific case of Javascript, you can use a framework testing, such as the qUnit (from the same team as jQuery).
With it, you can write tests that ensure your code works correctly. And since it runs right in the browser, you can run it in each of the browsers to make sure everything is OK. But remember that depending on how your application is structured, it can be difficult to test it. The more modular, the better.
You might be interested in reading more about Test Driven Development.
And as @Caffé already said, usually the developers of frameworks and libraries like the jQuery, Bootstrap, Foundation, etc.. have tested your codes in different browsers. Thus, working on them usually decreases the margin for problems.
I particularly also recommend avoiding excessive use of Javascript. Generating HTML on the server is easier, including maintenance. Use Javascript for what’s really needed.
Do not take into account IE6.
– Lucas Virgili
I don’t do segmented debug on IE. I simply rotate all functions of the application as if it were the user and try to find strange things, what I think I’ll solve...
– Junior
With the right +1 in Caffé’s answer, this is the kind of question that can be left unaccepted for longer because it attracts more "competitors" for a good answer.
– brasofilo
I do the reverse way, produce and test on IE, getting good at it is almost certain that it will look good on others... But the element that always of the difference is the damn select, this one looks different in each browser, they can not do in a pattern!
– Jader A. Wagner