Open mones-cse opened 5 months ago
Tricky. What's returning is the result of the last operation, But a keeps the 3 and doesn't change
Try
>a
0
Or try
> 1 + 2
And
> a = 1+2
to understand the difference and why it showed only the 7
@joaquinelio thanks
Hi there,
I've come across a section in the documentation (https://javascript.info/operators#comma) that explains the precedence of the comma operator.![image](https://github.com/javascript-tutorial/en.javascript.info/assets/6597869/fca37461-9b40-473c-941f-cb69a2234f2b)
However, it seems to have an error in its explanation. The example provided suggests that a = 1 + 2, 3 + 4 should result in a being assigned the value 3, whereas in reality, it correctly returns 7.![image](https://github.com/javascript-tutorial/en.javascript.info/assets/6597869/65ae140e-5286-4cd1-987c-f3e1105f11db)
I believe this discrepancy could lead to confusion among learners, and the explanation might need clarification to reflect the actual behavior of the comma operator. Thank you for your attention to this matter!