You're not desk-checking the code properly. It's wrong, but it works as expected.
The outer loop will loop i from 1-3
First iteration i=1
inner = data[1] => [1,2,3]
The inner loop will loop i from 1-3
First iteration i=1
nothing to do
Second iteration i=2
append inner to filtered => [1,2,3]
Third iteration i=3
nothing to do
end inner loop
i=3, which meets the exit condition of the outer loop
end of outer loop
filtered = [1,2,3]
I think you are misreading this line of code:
arrayAppend(filtered, inner);
You're reading it as:
arrayAppend(filtered, inner[i]);
But it doesn't say that.
Make sense?