DEV Community

Discussion on: There's no "else if" in JS

sanderintveld profile image
Sander in 't Veld

But surely some tasks just require if-statements? What if you receive an integer from user input and want to know if it is positive or not? What if you want to filter out all odd numbers out of a list? Isn't pattern matching on something with two cases just an if-statement with the first case as a condition?