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

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -