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

go - serving up pdfs using golang -

python - Best design pattern for collection of objects -

r - Using `bbmle:mle2` with vector parameters (already works using `optim`) -