Issue
What is going on in this Javascript code? Is there a name for this or some place to learn more about the specific behavior illustrated?
I didn't think coding a "tuple" in JS would be valid syntax, but it seems to be. However the resulting variable definitely doesn't behave as a tuple, which is expected given JS's lack of support for them.
It's behavior seems very odd to me though.
It only gets 1 of the two values stored into it, and strangely removing the parenthesis is still valid javascript but ends up storing the opposite value into the varible
-> x = (90, 27);
<- 27
-> x
<- 27
-> x = 90, 27;
<- 27
-> x
<- 90
Solution
Comma operator returns the last element
No tuples in JavaScript
Answered By - Konrad Answer Checked By - Pedro (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.