3 ms·
the only tools that will break your code if you don't use semicolons are so old they shouldn't be used for other reasons. At this point, you should really be us
by mattbriggs 15y ago
the only tools that will break your code if you don't use semicolons are so old they shouldn't be used for other reasons. At this point, you should really be using either yui compressor, closure compiler, or uglifyjs for reasons that have nothing to do automatic semi-colon insertion or not.
If you are still using something like packer, that bit of advice will take about 5 minutes of work, and give you significant decreasing of file size.
Semi-colons need to be in 1 place, the beginning of a line that starts with a (, since that is the one place that automatic semicolon insertion will really screw you. If it makes you feel good to write a semi colon at the end of every line I don't think anyone is stopping you, but it isn't the language or tools that require it. You can also feel free to explicitly wrap every statement in parens (because it is necessary in a few cases), or end each line with a // after your semi-colon, all these are freedoms the language gives you, but are as necessary as semi-colons.
I haven't been using unnecessary semi-colons in js for years, and have yet to run into a problem.