Hacker News new | ask | show | jobs
by shivajikobardan 1255 days 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?