You have to grow your coding experience in a different way. Experience is something that we have to acquire through hard work. We can’t get experience in one hour or one week.
Do you have any level of expertise on any programming language?
Use notepad as your code editor.
The special code editor has some features like autocomplete which will show automatically when you enter some character. Do not use this when you are a beginner. If you practice that way, you will get some confusion when writing your code. For example there is a function called getElementById(). You are practising your code in some special code editor where autocomplete features is present. So when you write “get” it will show different suggestion. You select getElementById() . This will help you to code more faster.
Now if you are using only note pad, and you type getElementbyId() (letter “b” in “by” is small caps). You will get some error like below-
Uncaught TypeError: document.getElementbyId is not a function
As this is case sensitive, you have to always follow the exact function name. You are practicing in code editor. That’s why you may not give attention to this small things. So first practice on plain note pad then use special code editor.
Now as a beginner when you write your code, always use a comment. The comment will help you to understand what is the purpose of this code. It may help other developers also to understand the logic. Suppose you have written a code a long time ago. Now you need to edit the code. Sometimes you can’t recognize the purpose of that code, why it was written for.
So the comment will help in this case. One more thing, lots of beginners write meaningless variable name-
var skjsd = 10; var kjk = 20; var lklk = skjsd + kjk;
Don’t use unnecessarily complex code-
If the code is simple it will be very easy to maintain. Unnecessary complexity will make your code tough to update or add new features.
Don’t write slow code-
There are lots of situation will come when you writing a script that you need to write the same script again and again. So it will make your code unnecessary long and slow when your browser execute the script.
So always avoid same code again and again. Try to write a function and call it when you need.
Use Inspect Elements to read your error-
All modern browsers provide Inspect Elements to check the error and change anything runtime. If you want to inspect in Google Chrome, right-click on the webpage and click “Inspect” or you can press Ctrl+Shift+I to show the Inspect element window.
I have shown previously that if you write getElementbyId(), your code will not going to work. You can get the error from Inspect Element’s Console tab.
Try to read the topic what I have marked out with red color and practice more.
When you ask your question, keep one thing in mind that you have to show your code mean what you have tried. It will help other experts to answer your question.