- Data Type:
Primitive Data Type: Primitive data type is that data which is not an object or method. There are 7 primitive data types: string, number, bigint, boolean, undefined, symbol and null. Though null is a special case for every object, but it’s primitive. Primitive values have something in common that means nothing can affect them or we can say we can not alter them.
Non-Primitive Data Type: Only objects are considered as Non-Primitive data.
2. Try-Catch: Try-Catch is used to handle error inside a code. Even if we’re great programmers, we can make mistakes when we write codes. Usually a code immediately stops when an error occurs. So in that case we can use the Try-Catch function to handle that error. Here is the Try-Catch Script:
First, Try is applied then if there were no errors then catch will be ignored but if an error occurs then the try will be stopped and catch will show up with the details of the error message.
3. Coding Style: Coding style is one of the most important thing to be a programmer. To become an efficient and high rating programmer one must have to be a good coding practitioner. To become a good coder someone must have to focus on:
- using curly braces properly.
- line length shouldn’t be too much horizontally.
- indentation should be perfect.
- Using semicolons after each completed line.
- Not to use too many functions instead try to use less in the best way.
- Use ESLint in VS Code to make auto styling of the lines.
4. Comments: Comments is another important part of coding. To become a good coder someone also has to be a good commentator. Clumsiness in commenting makes the code complex and less attractive to the viewer. Instead of commenting using the relevant name of variable could be a better choice which makes the code meaningful to any reader. Good comments allow someone to maintain the code well, come back to it after a delay and use it more effectively.