if statements translated to javascript