Task: Training on Odd March Bits 8 bits | Codewars

My solution so far

```
function bitMarch (n) {
//Initial array creation
var x = Array.from({length: 8-n}, k => 0) // eg for n = 5, x = [0, 0, 0]
var y = Array.from({length: n}, e => 1) // e.g for n = 5, y = [1, 1, 1, 1, 1]
var start = x.concat(y);
result = []; temp = start.slice()
for(let i = n ; i <= 8; i++){
//POINT OF ENQUIRY. Shouldn't this execute first, and first element of result...
result.push(temp)
//...be the first value of temp be [0, 0, 1, 1, 1 ,1, 1, 1] ?
s = temp.shift()
temp = temp.concat(s)
}
return result
}
```

Now t seems that that the for loop executed until completion BEFORE the arrays are added to the result? bitMarch(6) returns [[0,1,1,1,1,1,1],[1,1,1,1,1,1,0],[1,1,1,1,1,0,0]] . How can I fix the for loop so that the temp is added THEN shifted, rather than having what seems to be the shift happening first?