I saw this line in jQuery.form.js source code:
g && $.event.trigger("ajaxComplete", [xhr, s]);
My first thought was wtf ??
My next thought was, I canβt decide if it is ugly or elegant.
I am not a Javascript guru by any means, so my question is 2 times. First, I want to confirm that I understand correctly. Is the above line equivalent:
if (g) { $.event.trigger("ajaxComplete", [xhr, s]); }
And secondly, is this common / accepted practice in Javascript? On the one hand, it is brief, but on the other hand, it can be a little mysterious if you have not seen it before.
javascript short-circuiting
Davy8 Feb 19 '11 at 5:09 2011-02-19 05:09
source share