By accident when I was changing a Javascript code I made, I put a comma instead of ||
in a if
expression.
I changed if (that.busy || that.completed) return;
to if (that.busy, that.completed) return;
unintentionally, and noticed that it did not generate any syntax errors.
In addition, I did other tests that did not generate errors either:
var a = 1,
b = 2;
if (a, b) {
console.log('a', 'b');
}
if (1, b) {
console.log(1, 'b');
}
if (1, 2, 3) {
console.log(1, 2, 3);
}
So, I did not understand why Javascript would accept this. But probably this should have the purpose.
I wonder what this is for.