-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
  • 230,875
  • 49
  • 477
  • 553
non doe
  • 11
  • 1

3 Answers3

0

You can have as many as you want

mplungjan
  • 155,085
  • 27
  • 166
  • 222
  • 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
  • 239
  • 1
  • 7