I don’t get why this.array[0] equals 1 if this.array[0] = [(2,1)]?
What does Javascript do with the 2 and how do i reach/use it? How does parenthesis work inside arrays?
I’d like to do different things with X if the boolean before it is true or false.
this.array[0] = [(true, X)] and this.array[0] = [(false, X)].
Parenthesis in that context act as a statement with the last item passed being the passed value.
In other words:
The
2is evaluated, however, so:is effectively doing:
What you want in this case is [2, 1]