Long chains of else if: unwise?


In the introduction to JS, I came across this statement:

We can add more conditions to our if...else with an else if statement. The else if statement allows for more than two possible outcomes. You can add as many else if statements as you’d like, to make more complex conditionals!

Immediately, I wondered what the practical limitations on this were. Is it, as I presume, unwise to chain together a large number of else if statements? If so, why, and how much is too much?


Not unwise, as such, but difficult to read. That is why switch was created.


That was fast! Thank you. I will continue my studies.


Hi! How is life? You seem like a pretty cool person with some cool skills.