Javascript is Evil – Curly brace indentation

So I’m building a little DurandalJS SPA (single page app) test site tonight and while building the view model I do what I’ve typically done in the past when I run into Java curly brace convention, which is to plop that sucker down to the next line a la default VS C# convention.

Little did I realize that it was going to bite me in the booty and give me a crazy run around.

My view Model originally

return
{
    displayName: 'Cats',
    cats: ko.observableArray([])
};

The version that works in js

return {
    displayName: 'Cats',
    cats: ko.observableArray([])
};

¿c wut I did there?

Who in hell would be as so evil to seriously make that a difference and why has JS become the dominant language of the web? Unfortunately the question is rhetorical and it’s reason for success is numerous, but seriously the language is nasty. Once I get my sample running, I’m going to go investigate Typescript and Coffeescript. I’m such a web newb.


Posted

in

by

Tags:

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.