Just bumped into the fact that an if statement can have multiple parameters in javascript:
// Webkit
if (true, true, false) console.log("this won't get logged");
How well is this supported?
p.s. I get that this is similar to using &&, but this is interesting and a google couldn’t provide the answer.
If statements can’t have “multiple parameters”. What you observed is the use of the comma operator.
Now we see why
(true, true, false)doesn’t log anything whereas(true, false, true)will. As a side note, this syntax is ubiquitously supported (but should almost never be used).