You've to repeat the code and avoid copy-pasting, to learn it properly. Repetition is the way to grab the key points and save them in the repository of your brain. It's not time-wasting.
Ans . It's really common, to copy-paste the code and use it with some changes, but they don't copy one line of code like querySelector() or my recommendation is to learn the concepts and avoid the copy-pasting as a beginner. If you still don't understand??? Just don't do it(without any reason), It is going to help you in long term.
I saw a guy he just opened up VSCode and opened up 4 or 5 articles to set up Vue-router and using it and then he opened up a video and started following it while reading articles. I was shocked, there are more than two ways to set up the VueRouter and he can easily break things by following all the things practically.
I just want you to read all the articles or videos before jumping into the code. And choose two good resources(good for you), and then follow the first one. if anything goes wrong, try the other one.
Just ask for help, I guarantee you there will be some good coders around you who are willing to help. they are just waiting for you to ask them. don't feel ashamed asking your seniors, it's a good thing in some company cultures. I agree with the "Trial and Error Method".
First Try like there is no-one to solve this problem for you and then you can ask your friends or seniors.
Tip: StackOverFlow and GitHub issues are there always