4 ms·
I must tell why my confusion came here: Earlier in the code, we’ve done this: //head of snake let snakeArr = [ { x: 13, y: 15 }
by shivajikobardan 4y ago
I must tell why my confusion came here:
Earlier in the code, we’ve done this:
//head of snake
let snakeArr = [
{
x: 13,
y: 15
}
]
Here x,y means the grid row 13, grid column 15. That is why I’m confused. We’re using same variable names in 2 places with different meanings. In this question, we’re using x,y for direction(up,down etc).
How are we able to do this?