Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

"Also... lack of semicolons is bad style. Lack of braces for if clauses is bad style. Fix it, you'll thank me later. :)"

Although a popular opinion, it's still just an opinion -- one I strongly disagree with. Almost all semicolon problems in javascript are not caused by not using them, they're caused by not understanding when they will be inserted. The infamous example:

  function func(param, param2) {
    var meh = 0, gah = 0;

    <some more logic here>;

    return
      { meh: meh
      , gah: gah
      };
   }
Note: using a semicolon did not save you from returning undefined.

My point is that whether you use or don't use semicolons is not the problem. Not understanding when and how they're inserted is the problem.

I also find that people who do not use semicolons have a much better understanding of the few situations where they are actually needed to avoid errors.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: