The latest ECMAScript standard defines nine types of data, among them, seven types of data are primitives type, those are…
- Undefined type
- Null type
- Boolean type
- Number type
The other two types are …
- Object type
- function type
2. The second topic is Error handling. Whether you are a newbie or a senior programmer, we all sometimes make mistakes in our codes, in this case, our scripts have errors. Usually, a script stops in case of an error, printing it to the console. But there is a method using this method we can do some reasonable things instead of fully stopping our codes. And the method is try…catch method.
The instance of this method is….
The mechanism of this try…catch method is there are two blocks: the first is try block and the other is catch block. When we run our codes inside the try block, if there occurs an error the code instantly stops running and it goes to the catch block, and the err variable contains an object with details about what happened, otherwise, it will run end of the try block.
3. The third method is the standard coding styles. When we write codes we should keep our codes clean as much as possible. Because clean codes are very easy to read and understand.
For more details please see the links below
4. The fourth topic is comments. We always do comments in our codes for describing the functionality of codes. We do a single line comment using this // and a multi-line comment using this /*…*/. But there is a noticeable thing before we commenting, and that is we should know what is good commenting and what is bad commenting.
At first sight, commenting might be obvious, but novices in programming often use them wrongly. Novices tend to use comments to explain “what is going on in the code”. But in good code, the amount of such “explanatory” comments should be minimal. The code should be easy to understand without them.
Here I’m quoting a great rule about it.
“If the code is so unclear that it requires a comment, then maybe it should be rewritten instead”.
5. The fifth topic is the Default function parameters. The default function parameters allow a named parameter value to be initialized with the default value when no value or undefined is passed.
6. The sixth topic is the spread operator. The spread operator is a useful and quick syntax for adding items to arrays, combining arrays or objects, and spreading an array out into a function’s arguments.