Complementing @ Caffé's answer:
In the specific case of Javascript, you can use a test framework , such as qUnit (from the same team of jQuery).
With it, you can write tests that ensure that your code works correctly. And as it runs right in the browser, you can rotate it in each of the browsers to check if 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 may want to read more about Test Driven Development .
And as @ Caffé has said, usually the developers of frameworks and libraries like jQuery , Bootstrap , Foundation , etc. have already tested your codes on different browsers. So, working on them usually lessens the scope 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.