January 12, 2024Debugging

Why does my code work in my head but not on the computer?

debuggingbeginner-mistakescoding-habits

The Answer: You probably forgot to save the file! 🤦‍♂️

This is probably the most common mistake every developer makes, especially when starting out. You spend 30 minutes debugging why your changes aren't working, only to realize you never saved the file.

How to avoid this:

  1. Enable auto-save in your editor (VS Code: File > Auto Save)
  2. Use Ctrl+S (or Cmd+S) religiously after every change
  3. Check the file tab - unsaved files usually have a dot or asterisk
  4. Use hot reload in development - it will force you to save to see changes

Pro tip: Make saving a muscle memory. I save after every few lines of code, even if I'm not done with the thought. It's better to save too often than not enough!

Remember: The computer only knows what you've saved, not what you've typed! 💾

Share this silly question

Have you made a similar mistake? We've all been there! 😅

Read More Silly Questions