3 ms·
Unless you get a perfect score, don't omit semicolons http://asi.qfox.nl http://asi.qfox.nl Oliver Hunt, primary JavascriptCore engineer took this quiz and sai
by paulirish 16y ago
Unless you get a perfect score, don't omit semicolons http://asi.qfox.nl http://asi.qfox.nl
Oliver Hunt, primary JavascriptCore engineer took this quiz and said, "I rewrote our entire JS parser < 2 months ago, with all ASI rules and still didn't get 100% on a quiz"
- jacobolus 16y agoMost of those examples are designed to push the edge cases in confusing ways (i.e. bad code). Easy answer: don’t do that. Even if you include semicolons in all the “reasonable” places for them, it’s quite possible to get tripped up if you don’t understand what counts as a statement in JS and what doesn’t. Edit to add: For example, don’t write code like this, with or without the autoinserted semicolons: var x = function() { return (function(n){ return n })(n) }(function(){Math.exp( f )}) Someone else looking at the code is hardly going to be better off understanding it if you change that to: var x = function() { return (function(n){ return n; })(n); }(function(){Math.exp( f );});
- oomkiller 16y agoDo you write code like this? If so, you have bigger issues than ASI!