I've seen this subject many times.
var x = ten; var foo = { , function() { var x = +; returnthis. x; = foo.bar) (); Alert ((Foo.bar, Foo.bar) () );
Before you start, in the console, enter
A = 1;
b = 2;
(A, B);
will be displayed directly 2 this indicates that the comma operator directly returns the result of a subsequent expression
Look again
A = B and (a = b)
Output 2 indicates that the assignment operator returns the assignment result
Here is equivalent to defining a TMP = Foo.bar () and then TMP ()
But A.b () (A.B) () looks like they're different. An A object calls B () and the second one seems to be a function operation.
In fact, because a.b this expression does not do what operation the compiler will remove a layer of parentheses as A.B () to operate
So here the first two results are definitely the same after two is also
You might ask why the value of the following hint is not 20 but 10.
Because the next two is a function expression, you can think of it as an anonymous function.
They are equivalent
(function() { var x = +; Console.log (this// )returnthis. x;}) ();
About the classic topic of this