I know that in javascript the syntax (1, 'a', 5, ... 'b') will always return the last value but what does this syntax actually mean? When I see (1, 2) — which, admittedly is pretty much never — how should I parse that syntax?
I know that in javascript the syntax (1, ‘a’, 5, … ‘b’) will always
Share
That’s just the comma operator, which evaluates two expression and returns the second one. Since it evaluates arguments from left to right, if you have a list of arguments separated by commas the last one will be returned. From The Elements of JavaScript Style: