What are the common mistakes we make in Javascript

April 21, 2020 By Nobody No Body

Java script is a computer programming language. Unlike common languages we use, We need to be more clear with the commands we are giving to the computer. Because whatever the input you give that’s the result you get. So when we are writing code, we must make sure not to make the mistakes. So lets get to know the common mistakes we make in Java script.

The very first common mistake we make in Java script is not clearly knowing the difference between assignment operator “=” and comparison operator “==”. The assignment operator is used to assign the value to a variable whereas comparison operator is used to compare two values.

Not knowing the clear difference between addition and concatenation. Addition is when you add 2 numbers. The sum of two numbers will the output but in case of concatenation. When you use concatenation to add two numbers then the two numbers will come one beside the other. In this case the sum of two numbers will not be the output.

The next common mistake we make is misplacing the semi colons. This is because of the confusion between where to end syntax with semi colon. Happens most of the time. Even beginners sometime use semi colons in the beginning of conditional statements.

Leaving the statements incomplete, When we leave the statements incomplete in Java script the code will read the next line to fill up the value. This is why it is not suggested to leave the statements without providing the value. At least you must finish the statement with semicolon.