Length of snake not increasing

if(headX==food.x && headY ==food.y)

        {
            food = getRandomFood();
        }
        else
        {   
            this.cells.pop();
        }
        var X,Y;
        if((headX>=0&&headX<=12)&&(headY>=0&&headY<=12))
        {
        if(direction=='right')
        {
        X = headX + 1;
        Y = headY;
        }

Hey @sherryjain17
You can check the source code here and verify


Happy coding !!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.