Wednesday, February 22, 2017

Just Don't Write Ambigous Code

I've stopped putting semicolons in my javascript, at least for my own projects. It makes code so much easier to read. But wait?  Don't we need semicolons in cases where the code is ambigous?

Sure. But why write ambigous code? Unless you are competing to write the longest one line program, there is no point.

If I need a semicolon to make my javascript work, then my code isn't clear. And when I come back to it in 6 months, I'm going to be Say What? Semicolons are like a yellow flag saying 'Why are you doing it this way'.

Actually, like nost best practices, the real best practice is don't blindly follow the best practice, instead you should think.

There are actually some places I still use a semicolon. For loops for one. And switches:

switch(op) {
 case 0: doZero(); break
 case 1: doOne(); break

And of course, if maintaining existing code where the style guide calls for semicolons, please respect it.

Here is an actually informative posting on the subject:


  1. Pleasant to visit your site page once more, it has been months for me. Well this article i have been sat tight for so long. I require this piece to finish my task in school, and it has same theme with your piece. Much appreciated, incredible offer… .
    essay writing service reviews

  2. A typical day on the job varies dramatically depending on the size of the organization and the scope of the position. Assignment Help

  3. It is a compacted arrangement and does not consume up much room. writable-pdf

  4. This comment has been removed by the author.

  5. Good to read such an informative post. I find it interesting and is pretty fascinating, By reading your post I got very useful information. Thanks for sharing this post. Keep posting more content like this, it is a very nice blog. I recommend you to visit

  6. Thanks for highlighting the importance of using clear and descriptive variable names, which I think is often overlooked in a rush to get code written quickly. It's so important to take the time to choose names that accurately reflect the purpose of the variable or function, as it can make a huge difference in how easily others can understand and work with the code. Dissertation Help Online