DEV Community


Discussion on: Clean up your code by applying these 7 rules ⚡️

felipemartins81 profile image
Felipe Martins

Good solution for 'If statements' issue!
What about this way?..

switch (value) {
    case 'duck':
    case 'dog':
    case 'cat':
        // ...
Enter fullscreen mode Exit fullscreen mode
joachimzeelmaekers profile image
Joachim Zeelmaekers Author

In this case this would be a good solution, but it gets really big when you have to check 10 options for example! The switch statement is also not available in Python for example.