Why should we use shorthand if instead of if/else statement in JS?
JS Shorthand if In JavaScript, we call the ternary operator shorthand if statement. We can use the ternary operator instead of if/else statement. It's also called the conditional operator, and…