Is there a limit to how many conditions (e.g., logical OR conditions) that JavaScript allows me to have in an if statement, or can I have as many as I want?
Asked
Active
Viewed 90 times
-2
3 Answers
0
You can have as many as you want
mplungjan
- 155,085
- 27
- 166
- 222
Irshad Baiwa
- 11
- 3
-
You can use as many or conditions in an if statement. All will end in a single boolean value. – TarJae Feb 06 '21 at 08:00
0
If technically have not limits, but If you want a clean code, I recommend you use switch case.
Know more about how to write better conditionals statements here: https://www.digitalocean.com/community/posts/5-tips-to-write-better-conditionals-in-javascript
Pedro Felgueiras
- 111
- 1
- 8
0
There is no limit to use as many as conditions you want , but if we have so many conditions its always good practice to use SWITCH case to make code clean and efficent.
Shivansh Seth
- 239
- 1
- 7