6 minute(s) read
Published on: Jul 20, 2021
Updated on: Dec 14, 2021
- The "+" Symbol can have many uses, for example it may be used for Addition and Concatenation.
While coding, it is possible to ignore whether a number is written as a string or not, which eventually leads to similarities, as a result, you cannot see the desired result.
In fact, programmers may sometimes forget that the data which they have entered may be evaluated as a string, not a number, which can cause the data to join each other, as a result, no collective operations will be carried out. This mistake is very common, so that it is necessary to be careful in entering different data, so when needed, numbers are entered in strings, and otherwise they are entered numerically, now consider the following example for a better understanding.
If you write out the code: var x = 10 + "7"; it goes up to "107,"
As you can see, the numbers 7 and 10 are only joined together, and because 7 is written as a string, the two are not added together.
- Confusing the assignment (=) and equality (==, ===) operators, each of these items need to be used in their proper place and have a different meaning, if you as a programmer, do not know where to use each of them, in the end you cannot do the right programming.
When you want to compare two data, you need to use (==, ===) operators, the difference between the two is that three equals can make more accurate comparisons while two equals can perform a loose comparison in which only values are compared and the datatype is no longer checked and compared, now consider the following example in this regard for a better understanding.
In this example, the variable number was assigned a string value of 1, it returns true when compared with 1 (of number type) using double equals because both values are 1, but when compared using triple equals, it returns false because each value has a different data type.
One of the inevitable mistakes that can occur is memory leaks, which you can prevent by being aware of the issue and the factors that cause it to take place, now note the following code:
- Another mistake that may be made by various programmers, especially beginner ones, is that they do not do any planning and research for coding and rush into the coding step, which in the end make them write the code without a plan which can cause many mistakes to occur.
Before programmers start coding, it is necessary to carefully examine all the available items and check what input they need to have for the outputs which they are targeting, and then enter the coding stage, so that there is no need to rush.
The steps that a programmer needs to take from the beginning include Writing, Validate, and Modified, and doing all the steps, respectively, can reduce the number of mistakes that a programmer may make while programming.
Also, the point that needs to be mentioned in the event of a problem is to break the complex problems that have occurred into smaller problems and solvable parts, so that you can solve the problems that have arisen easier than before, due to the fact that solving a complex problem will take more time and energy.
- Failure to make a backup while doing the work can cause you to lose track of time spent doing something and be forced to rewrite the code, for example, imagine that there was a problem with your system due to low physical security, and you had spent a whole month programming before the problem occurred, but due to the fact that you were unaware of the possible occurrence of such problems, you did not provide any backup, so that you end up having to spend a lot of time doing what you have done before, one more time.
This mistake is very common among novice programmers, and it is often seen that programmers have wasted all their efforts due to negligence, you have to learn to use source control (SVN or Git), Github, or you can use Dropbox, a cloud service, to save your work at any time.
- Do not underestimate your abilities, due to the fact that one of the common mistakes that beginner programmers make is that they underestimate all their talent and doubt all the code they have written which can cause them to make many mistakes in the future and make some mistakes that can lead to bad results, so it is necessary to have enough confidence to do all the things they know about this issue so that they can achieve the desired results.