try/catch/finally,Arrow-Function,Semicolon,Coding-Style,Comment,Spread operator,Caching,Cross Browser Testing,Data Types.
Caching:
Consuming APIs is every day’s meal in JavaScript, this also has its limitations, amount of requests per second is the most common, in this case, we are going to implement an algorithm to cache data based on time. Let’s say we are sure that the data we are going to fetch is not going to change in a certain period of time then we can cache the data for that span. Some data can be cached by seconds, minutes, or even days.
Spread Operator:
Three very powerful dots, that allow you to expand arrays or iterable objects in places where array elements or key-value pairs would be expected.
const arr1 = ['one', 'two'];
const arr2 = [...arr1, 'three', 'four', 'five'];//['one', 'two','three', 'four', 'five']
Comment:
Comments in JavaScript enable the developer to add notes about the script or comment out sections of script that should not be executed by the interpreter. Comments can be single line comments (using the // marker) or multi-line (beginning with /* and ending with */).
Commenting is considered to be good practice. Regardless of how well you understand the logic of some JavaScript, there is a good chance you may one day have to return to that script and modify it. Often this can be months, or even years later and what seemed obvious to you at the time you wrote it may seem less obvious in the future. Also, it is often likely that some other person will have to work on your scripts in the future. For both these reasons it is a good idea to provide at least some basic amount of commenting in your scripts.
Coding Style:
Here is a summery with some suggested rules.
Semicolons:
Semicolons should be written after each line of statement.
Arrow functions:
The core structure looks like this:
(argument1, argument2, ... argumentN) => {
// function body
}
try/catch/finally syntax:
=> try...catch
only works for runtime errors.
=> try...catch
works synchronously.
Cross Browser Testing:
Cross-browser testing is simply what its name means — that is, to test your website or application in multiple browsers- and making sure that it works consistently and as in intended without any dependencies, or compromise in Quality.
Data Types:
JavaScript has total nine types of data or you may say values in two major categories. The primitive types and the Objects and Functions. Primitive types are values which we can use only not modify them.
Objects and Functions
● Objects ({} and others), used to group related data and code.
● Functions (x => x * 2 and others), used to refer to code.
Anything else than those above types falls into the Objects Category.
Primitive Types
● Undefined (undefined), used for unintentionally missing values.
● Null (null), used for intentionally missing values.
● Booleans (true and false), used for logical operations.
● Numbers (-100, 3.14, and others), used for math calculations.
● Strings (“hello”, “something”, and others), used for text.
● Symbols (uncommon), used to hide implementation details.
● BigInts (uncommon and new), used for math on big numbers.