ternary operator vs if else javascript