DEV Community

Discussion on: 2 Tips to Clean Ugly if Statements

Collapse
 
amiceli profile image
amiceli

Another tips I use :

if (a === "test" || a === "foo") {}
Enter fullscreen mode Exit fullscreen mode

Better I think :

if (["test","foo"].includes(a)){}
Enter fullscreen mode Exit fullscreen mode