If you’re looking to learn how to write JavaScript, you’ve come to the right place.
Each programming language has its own rules, just like English. Think about it. When you were in elementary school, you learned grammar rules to structure sentences.
Much like English, programming languages ​​follow rules to ensure that everyone can understand what is being said. Imagine if we could all create our own rules when using English. No one could communicate. Likewise, programming languages ​​are strict on the rules so that the code you write can be executed.
In this guide, we’ll cover JavaScript syntax. Syntax refers to the set of rules that define how code is written in JavaScript.
Why is syntax important?
In JavaScript, you must follow certain syntax rules. For example, if you don’t close a hook after opening one, an error will be returned. The computer cannot continue to run your program because it does not understand what you are telling it to do.
This deserves an important distinction between computers and humans: while humans may be able to identify the occasional error and skip it, computers cannot do the same when executing code in any programming language. This is why it is important to write code using the syntax of the programming language you are working with.
The syntax also makes your code more readable. When everyone uses the same syntax, it is easy to interpret each other’s programs. Just like in English, once you know the basic rules there are no more lines of code that you cannot read.
In this guide, we’ll focus on the following syntax features: