In JS, there is no negative numeric literal. `-500` might look like one, but it's actually +500 negated using the unary `-` operator.
The more you know 
-
-
Do other C-like languages (incl. Java and of course C) work the same way?
-
C does the same thing, based on http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4727.pdf …
End of conversation
New conversation -
-
-
What would be the point of an ‘else if’ construct? What you explained sounds almost like an elegant solution!
-
It is a single construct in Python, for example (`elif`). Programmers tend to think of `else if` as a single atomic part of the language everywhere. (Of course, the difference doesn’t matter in practice.)
- 1 more reply
New conversation -
-
-
This is very interesting. Where is this documented?
New conversation -
-
-
Thanks, I hate it.
-
Knowing this gave me indigestion. Now I’m going to see imaginary nesting every time I look at any else if.pic.twitter.com/H5z6Yln0sI
- 1 more reply
New conversation -
-
-
Does this mean you could put anything next to else, does it have to be if?
-
It could be anything, e.g. if (true) console.log(1); else console.log(2);
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.
…but it’s just an `if` nested within an `else` block without braces.
else if (x) {}
→
else { if (x) {} }