Completing if and elseif in JS