0
I would like to know what are "expressions" and "primary expressions" in javascript. The Mozilla as an example of expression x = 7 and 3 + 4, but in the "primary expressions" part it shows the "this" which is a reserved word and has nothing to do with x = 7 or 3 + 4 and shows the "()" (cluster operator). If possible also explain what is "left side expression" that is also displayed on the website.
The question marked as duplicate already answers what is an expression, but only to complete in relation to
this
- think about expression as all that returns a value when it is evaluated. Thus, thethis
(as any other variable), when it is "read" by Runtime, will return the value of Binding. Thethis
is nothing more than a variable, considered "special" because it is always implicit in the execution context.– Luiz Felipe
in the link itself explains "An expression consists of any valid unit of code that is solved as a value", that is, something that solved generates a value, can assign or not to a variable this value, as the examples that put
x = 7
the value is 7, assigned tox
and here3 + 4
the value is 7 but has not been assigned, probably will be used as part of a larger expression, for exampleif (y == 3+ 4)
orif (y > 3 + 4)
, etc. The link is very detailed, perhaps missing an example of expression on the left, asx += 2
or calculates x+2 and assigns to the left the same asx = x + 2
– Ricardo Pontual