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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -