let’s write a Snake game in plain JavaScript - playproduction.de

let’s write a Snake game in plain JavaScript

Views: 49373
Like: 1352
We’re building a Snake (in the style of the original Nokia 3210 implementation). Final code you can play with:

00:00 Setting up the stream
02:32 Which version of Snake we’re implementing
05:33 Rendering the snake
24:20 Getting the snake moving
36:07 Adding arrow keys handling
52:46 Handling multiple fast keypresses
1:07:10 Snake shouldn’t pass through walls or itself
1:20:46 Spawning food (randomly and buggy)
1:33:25 In-game restart button
1:40:19 Spawning food (non-buggy but unbounded)
1:44:46 Spawning food (bounded but with unnecessary allocations)
2:18:27 Spawning food (efficiently)
2:29:04 Implementing integrity checks

if you liked this, check out my beautiful dark twisted javascript course:


  1. thanks for this beau! I use chrome as my test area and wrote this code on VScode, it didn't display nothing, please help. What IDE do you use?

  2. Great stream, Dan, I hope you’re having fun and keep streaming!

  3. I do hope there will be more videos like that here

  4. Do make videos specific on react internal concepts please. Something like in depth explanation of useState hook or something like that. Would love to learn from you💟

  5. is this your official YouTube channel Dan?

  6. You have a lot of patience to code something like that.

  7. I hope more stream like this comes. The thinking process also teaches viewers on possibilities on how to tackle scenarios. Great stream. ❣

  8. he is preparing for new position in Nokia

  9. Awesome video, thanks for the content but they are really long. If you need someone to edit your stream videos and manage your YT channel, I'd be happy to do it.

  10. Dan I like you and the stuff you do but… Please buy a Sublime license man… I'm pretty sure your Meta salary is high enough to afford it 🤣

  11. "Final code you can play with" it means I can edit the code or copy from the code and do whatever I want with it?

  12. How did you manage to get 12k subscribers with only 13 videos? Do you stream on other platforms?

  13. This is much more interesting and better than those "code snake under 5 minutes in Javascript" videos where they all just memorize everything.

  14. this was a lot of fun, thanks for making these Dan! :heart

  15. Really appreciate that showing how to implement the game in reality!

  16. Thank you for this. I'm self-taught. This helps me polish up my thought process.

  17. Normally I don't click a video which is more than 15 minutes. But I am going to dedicate a peaceful weekend to practice this as the video goes. Good video. Time to think for the users as well instead of pausing.

  18. Thanks for uploading this kind of videos. It looks containing every consideration you have done. Very helpful.

  19. I'm going to try to learn Javascript but I suspect that I have some sort of adhd issue.
    Btw, idk if anyone ever told you, but you kind of sound like (the singer) Michael Jackson?
    Have you heard of Chat.Openai? Wondering if you have or not… nvm I'm going to try to watch the video. Before I do, I'd like to ask if you believe in free will? Or do you think we are like computers in a way?

Leave a Reply

Your email address will not be published.