-2

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?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
non doe
  • 11
  • 2

3 Answers3

0

You can have as many as you want

mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • 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

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
  • 311
  • 1
  • 8