Does it happen to everyone

I find it hard oftentimes to sleep, because all that will be coming head is one new thing i learnt in JavaScript or how to fix/write a code… And hours could while doing so - before starting JS, I literally would sleep 2s after getting in bed. Does it happen to you? And how do you overcome or cope with it?

1 Like

hi there @samolex!
It happens to me quite often. working with your brain sometimes even harder than physical work. your brain works 250% while learning so it should be throttled down before you sleep.
In my case it helps making something not codieng oriented: take a walk, listen some music… free your mind (and the rest will follow) :upside_down_face:


Thank you, Eldorado82. I will utilise some of the advice

Maybe this helps:


You are not alone! I have also struggled with my mind working overtime after coding, especially if I ran into a problem I had not solved yet. I learned to set a boundary; to tell myself “that’s enough for today”. Then, as it was suggested above, I engage in an entirely different activity that also serves to relax and prepare me for sleep. It’s more or less the same thing as telling a child “no more ice cream tonight” lol.


Thank you for the advice, robynj!

@samolex You’re more than welcome and I’m glad if I helped even a little. Personally, I need all the help I can get on my coding journey :grinning:

I personally am not the type that falls asleep fast once in bed, it usually takes me a few minutes. However, I never attribute tossing and turning to code.

The main reason why is because I purposely stop coding an hour or so before bed. The most optimal thing I end up doing is reading a few random things, could be about movies, sci-fi, the universe, space news, tech news, almost anything.

The goal is more just to clear my mind, and not think about code. The few times I’ve went from coding, or solving tough problems, I had trouble going to sleep with any speed.

Spend some time to “clear your mind”, and relax before bed, its good to create a barrier to your sleep, rather than try to go from thinking hard to trying to not think at all haha.


I don’t have any trouble getting to sleep, but I did notice something weird: I often dream about coding. How strange; I never would have thought this could happen.

1 Like

Thank you for your words!

Yours is even worse. Probably a good thing, haha.