(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

(3).Comments

(4).Cross Browser

(5).Block Bindings

var a = 1let b  = 2const c = 3

(6).var Declarations and Hoisting

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

(8).Block Binding in Loops

for ( let i = 0 ; i < 10 ; i++ ) {

process ( items [ i ] )

}

// i is still accessible here

console.log( i ) ;

(9).Functions with Default Parameter Values

function ( x, y = 2 ) {

// function code

}

(10).Arrow Functions

hello = () => {

return “Hello World!”;

}