Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Commonmark migration
Source Link

There is no practical difference. They will both result in an anonymous function being assigned to a.

The first is a "simple assignment". In the second, the parentheses are acting as a "grouping operator", which does one thing:

The production PrimaryExpression : ( Expression ) is evaluated as follows:

  • Return the result of evaluating Expression. This may be of type Reference.

So the grouping operator will return the function contained within it, and assign it to a, just like the first example.

There is no practical difference. They will both result in an anonymous function being assigned to a.

The first is a "simple assignment". In the second, the parentheses are acting as a "grouping operator", which does one thing:

The production PrimaryExpression : ( Expression ) is evaluated as follows:

  • Return the result of evaluating Expression. This may be of type Reference.

So the grouping operator will return the function contained within it, and assign it to a, just like the first example.

There is no practical difference. They will both result in an anonymous function being assigned to a.

The first is a "simple assignment". In the second, the parentheses are acting as a "grouping operator", which does one thing:

The production PrimaryExpression : ( Expression ) is evaluated as follows:

  • Return the result of evaluating Expression. This may be of type Reference.

So the grouping operator will return the function contained within it, and assign it to a, just like the first example.

Source Link
James Allardice
  • 166.4k
  • 22
  • 335
  • 316

There is no practical difference. They will both result in an anonymous function being assigned to a.

The first is a "simple assignment". In the second, the parentheses are acting as a "grouping operator", which does one thing:

The production PrimaryExpression : ( Expression ) is evaluated as follows:

  • Return the result of evaluating Expression. This may be of type Reference.

So the grouping operator will return the function contained within it, and assign it to a, just like the first example.

lang-js

AltStyle によって変換されたページ (->オリジナル) /