As a c# coder learning JavaScript I find this alot more readable:
$(this)
.first()
.prepend("<h3>Title</h3>")
.end()
.removeClass("hidden");
than this:
$(this).first().prepend("<h3>Title</h3>").end().removeClass("hidden");
However JSLint complains about the first one. But I don´t understand why. Will this get me into trouble anywhere?
Update:
You can set the value of indentation at the bottom of the jslint page and thereby make your code “valid”. There is a fork of JsLint, http://www.jshint.com/, that accepts tabs as well.
The warning from JSLint is a matter of taste. Whoever wrote it finds that arranging things this way makes more sense:
I for one find your approach more clear because the dot tells me that whatever comes after it belongs to the line above.
You’re safe with the way you are writing, but I would really like to see someone (jslint devs) tell us how to disable that message.