Two Things About Conditionals In Javascript

The first “thing” in this post is the most interesting: in Javascript, there is no “else if”. After working in Ruby for awhile, where they use the almost-english symbol “elsif”, I was wondering why “else if” in Javascript was two symbols instead of one. Turns out, it’s not an “else if” symbol, it’s merely an “else”, with no curly brace, followed by an “if” block.

You learn something new every day. (As is to be expected, this is well-documented on MDN. But when something works the way you expect it to, you don’t always look into why.)