Use logical AND/OR for conditions

Instead of using an if-condition, you can use a logical AND/OR. This can be used within a function for executing commands.

const input = 2
input === 5 && console.log("it si 5")
input === 5 || console.log("it is not 5")

Leave a comment

Your email address will not be published. Required fields are marked *