function startGame() {
        currentSnake.forEach(index => squares[index].classList.remove('snake'))
        squares[appleIndex].classList.remove('apple')
        clearInterval(interval)
        score = 0
        randomApple()
        direction = 1
        scoreDisplay.innerText = score
        intervalTime = 1000
        currentSnake = [2, 1, 0]
        currentIndex = 0
        currentSnake.forEach(index => squares[index].classList.add('snake'))
        interval = setInterval(moveOutcomes, intervalTime)

    }
//to start, and restart the game
to start, and restart the game
to start and restart the game
function startGame() {
        currentSnake.forEach(index => squares[index].classList.remove('snake'))
        squares[appleIndex].classList.remove('apple')
        clearInterval(interval)
        score = 0
        randomApple()
        direction = 1
        scoreDisplay.innerText = score
        intervalTime = 1000
        currentSnake = [2, 1, 0]
        currentIndex = 0
        currentSnake.forEach(index => squares[index].classList.add('snake'))
        interval = setInterval(moveOutcomes, intervalTime)
    }
function startGame ( ) { currentSnake . forEach ( index => squares [ index ] . classList . remove ( 'snake' ) ) squares [ appleIndex ] . classList . remove ( 'apple' ) clearInterval ( interval ) score = 0 randomApple ( ) direction = 1 scoreDisplay . innerText = score intervalTime = 1000 currentSnake = [ 2 , 1 , 0 ] currentIndex = 0 currentSnake . forEach ( index => squares [ index ] . classList . add ( 'snake' ) ) interval = setInterval ( moveOutcomes , intervalTime ) }
to start, and restart the game
to start and restart the game