I've decided to take your advice and improve the style of my code.I would like to know what do you think of it now,and maybe what's more needs to be changed.Though I'm not sure if I refactored it correctly because now my JS script has 100 more lines of code.

I've divided my code into 4 modules:

1.GAME_STATE - responible for everything while player is not dead.Updates data,draws on the canvas

2.GAMEOVER_STATE - updates localStorage and handles user input on the Game Over screen

I like what you do with defineAppleProperties, using the while loop to determine the apple location, but it could cause issues;

If the player has a perfect game, the snake will fill the entire map if he ate the last apple. If that happens, you have an endless while loop, causing a tab/browser crash. I would check the snake length vs amount of positions on the game board to fix that.