(1).Error handling, “try…catch”
No matter how great we are at programming, sometimes our scripts have errors. These could be due to our error, an unexpected user input, an incorrect server response, and a thousand other reasons. Typically, a script “dies” in case of an error (shuts down immediately), it prints on the console.
However, there is an attempt to compose a sentence…Suppose that is ours to “catch” errors gives so that the script to die to go instead more reasonable could catch something.
try {
// code…
} catch ( error ) {
// error handling
}
(2).Cooding Style
Our code needs to be as clear and easy to read as possible. This is actually a complex task in the programming industry and coding it in the right way
And both human readable. A good code style helps a lot in this.
(3).Comments
Comments are usually used to describe how and why the code works.
As we structure the code As I know, comments can be single line : // and start giving in multiline : / * … * /.
(4).Cross Browser
Cross Browser Testing is the practice of making sure that the web sites and web applications you create have an acceptable number of web browsers works across.
(5).Block Bindings
The task of declaring variables has become a complex issue in JavaScript programming. Most C is a variable or binding in the financial language where the specification occurs.
var a = 1let b = 2const c = 3
(6).var Declarations and Hoisting
Variable declarations of variables are considered as if they are at the top of the function or the global scope is outside of a function announcement if the actual announcement wherever it is is called lifting. The following function to demonstrate what lifting does definition consider.
function getValue ( p ) {
if ( p ) {
const value = “ white ”;
// other code
return value;
} else {
// value exists here with a value of undefined
return null
}
// value exists here with a value of undefined
}
(7).Block-Level Declarations
Block-level declarations are changes that are made to access-declare block scopes outside of a given block scope. How many C-based languages work within a block within a function and indicated by letters it’s block scoping and ECMAScript introduction of block level declaration to bring the same flexibility and uniformity in JavaScript.
(8).Block Binding in Loops
Probably an area where developers block most variables want level scoping It is between loops where the throw way counter variable is just a loop Inside used is. For example, JavaScript is not uncommon to see this kind of code
for ( let i = 0 ; i < 10 ; i++ ) {
process ( items [ i ] )
}
// i is still accessible here
console.log( i ) ;
(9).Functions with Default Parameter Values
Functions in JavaScript are unique because they are functions
the definition is that regardless of the number of declared parameters allows passing any parameters. This is usually the default if you are not provided with parameters functions that can handle different parameters by filling values let me define.
function ( x, y = 2 ) {
// function code
}
(10).Arrow Functions
ECMAScript 6 most of it interesting new is one of the parts arrow function. Arrow function by name the shot is with a new syntax adjusted function that uses “arrow” (=>).
hello = () => {
return “Hello World!”;
}