Strange javascript syntax -
anybody can me following js syntax? don't understand line starting "( $.inarray( wzdid, this...." mean why line start parentesis? mean?
this complete code:
_activatestep: function( wzdid ) { if ( condition ) { var stepindex = this._findnav( wzdid ).index(); for( var = 0; < stepindex; ++i) { if( condition ) === -1 ) { return; } } ( $.inarray( wzdid, this._activatedsteps ) === -1 ) && this._activatedsteps.push( wzdid ); } }
thank you
what have here is
a && b
it uses common trick based on short-circuit logical operators : b executed if true.
that's way write
if (a) b;
some people because it's little shorter. it's less readable too.
Comments
Post a Comment