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

Popular posts from this blog

angular - Converting AngularJS deffered promise to AngularX observable for JSOM -

python - What's the Pythonic way to report nonfatal errors in a parser? -

python - AssertionError when trying to assert return value from two dictionaries with py.test -