javascript - Translate ternary operator into if/else statement? -
i'm still learning javascript language , ran bit of code. wondering if possibly "translate" if/else statement make easier me understand what's happening? thanks!
var offsetx = (w < 0) ? w : 0; var offsety = (h < 0) ? h : 0;
var offsetx, offsety; if(w<0) offsetx = w; else offsetx = 0; if(h<0) offsety = h; else offsety = 0;
Comments
Post a Comment