As a self-taught programmer, you might also benefit from books that offer broader advice on the profession. You’ll improve your thinking and habits, traits you can apply to any language you decide to learn. Steve McConnell’s 900-page Code Complete: A Practical Handbook of Software Construction (2nd Edition) is considered the definitive guide for best practices, with data-backed advice on everything from project design to debugging code.
Also, something that I've found is that if you go wrong somewhere instead of mindlessly searching for the error (assuming there are multiple or you don't know the error's location) just start from the beginning and go down seeing that if this works. If you see a break and something disconnects, in all probability that's where the error is. It's all logic.
This is our best piece of coding advice: If you can’t figure out why your code is broken, you can always look for solutions online. You’re probably not the first person to make your mistake, after all, and someone on the internet has surely already found a solution to your issue. Just “copy and paste” your error message into Google (or your preferred search engine), add a pair of quotation marks around the entire phrase so that you’re not just searching for keywords, then hit “Enter.” Hopefully, this little trick will lead you to the correct answer.