It is not easy to start to learn to program, there are multiple ways to learn and depending on what you want to do, you need to learn a broad set of tools just a bit to combine them in order to do what you want. Take a task like, "I want to make a website", that can both be super simple and super complex, because compared to having a task "I want to build a house", you can be done with a website in 5 minutes and that is the magic part. It doesn't need to take 2 years to build your first website, but the journey from learning how to build a website in 5 minutes to build a website that takes 1 year is super bumpy.
Find your motivation - When I first started I didn't know anybody that knew who to program, it made it quite exciting because it made it feel like I discovered something really exciting that I only knew. I found my motivation on why I wanted to learn to program and that is my first advice, figure out why you want to learn it. If you don't know, don't worry, the solution is just to try out a lot of different stuff and see what you think that sticks.
Always do short iterations - Learning is about making mistakes, it is guaranteed that you are going to make mistakes and luckily in programming, it does matter and the iteration time is amazingly quick compared to doing for example hardware development. What that means is that you should use this as an advantage. Figure out at the start the feedback loop that works for you! The best programmers I know have figured out how to get the feedback loop as small as possible so when they write something they know quickly if something has broken and exactly was has broken. If you are beginning, that means maybe going to the extreme and test for every word you write in your code editor and as you get better, you can increase that but still have the same confidence.
The biggest mistake I see for people that are learning to code is that they write a lot of code, sometimes copy and pasting and they have no idea what broke and why so much has changed since they tested it and now instead of writing more code they have to spend time debugging or going backwards and deleting code.
Never copy and paste - When I started learning to program I copy and pasted a lot of code, and what that taught me for a long time was that I could not write the code myself and at the start it seems like a great way to save time, because why write it myself when I can just select it with my cursor and copy paste? The problem is not the code itself, but the step to becoming a better programming becomes larger and larger, as your code gets more complicated you simply can't find that on StackOverflow and paste it in and because you copy/pasted a lot before, the words that you use for programming does not lie in your muscle memory. Suddenly it feels impossible to get to next step of writing your own programs.
Focus on publishing - You should always be focusing on sharing what you have built, the first reason is that you should be proud of what you are accomplishing, second is that it teaches you valuable skills along the way. If you always know how to publish your code / your website / your app, you can get feedback and ask for help, if you don't know how to publish, your code often stays on your computer which doesn't help you or anybody.
Publishing also breaks up your project into chapters like a book and gives you a good excuse for ending the chapter in a good way before you begin the next one.
Find a group of people - You should go out into your community and find like-minded people that you can connect and share with. It can be a group on the internet, but meeting face-to-face is still valuable and keeps it real in this internet-age. Luckily that is not difficult with pages like meetup.com or Facebook events where a lot of people organizes events for programmers to meet and collaborate. I, for example, organizes CopenhagenJS because I like bringing people together and when I arrived in Copenhagen many years ago it was so valuable for me!
Make your own website - Invest in making your own website. This one can seem silly and it is a little bit, but your own website is something that you can invest time into and grow over time, it is your piece of the internet that you can control and you can express what you want there! It is an incredible privilege and we should not take it for granted that we can have something for ourselves, and don't worry about it being weird or that people will laugh at you, it is awesome and cool to self publish!
Previous post: You don't need the latest npm package of everything
Newer post: How to handle LitElement input onChange