“Expert JavaScript ”

4 min readNov 3, 2020

1 . Discuss about Error handling

  1. in error handling using Four keyword
  2. try
  3. catch
  4. finally
  5. throw

2. why use error handling?

Then if we create large apps suppose 1000 line code in the run time has found anyone line error we can not see our output for that reason using error handling. if we use try catch it’s ignore the error code and display the output.

declaration of try..catch






catch is a function it work is before find execution error handle

try work where error have a possibility that’s place



alert(“Hello everyone”);

alert(“Bye Bye”);



alert(“Inside catch block”)


if try block code is ok catch block does not work but in try block have identify error then catch is work and ignore the error and the output

3. try..catch only work for run time error

JavaScript engine first read the code and then run

2. try catch use finally block

finally block always work if error have or no error it give the output


alert(“Hello everyone”);

alert(“Bye Bye”);



alert(“Inside catch block”)



alert(“God bless you”);


1. throw statement

throw statement create custom error.

The throw operator generates an error.

throw <error object>

  1. There may be no catch section or no finally, so shorter constructor and try..catch are also valid.

3 .Coding Style

Our code must be as clean and easy to read as possible.

coding style is the actually the art of programming

  1. Curly Braces
  2. line lentgh
  3. Indents :
  4. semicolon
  5. nesting lavel
  6. function placement
  7. style guide
  8. automated linters

this is very important for the coding style

4 .JavaScript comments

well programmer maintain all code decoration comment is one of them

// this is single-line comment

/*…….*/ multiline comment

those use the visual studio code or VSCode use

ctrl +slash

5. ES6/ECMAScript

block statement or compound statement in block statement code execute only inside block not other

example :

var x = 1;
let y = 1;

if (true) {
var x = 2;
let y = 2;

expected output: 2

expected output: 1


hoisting is like scope where we declare variable it’s define and when we declare variable how javaScript deal that variable that is hoisting

  • Hoisting Bangla meaning Uttolon or Uporer dike tola
Hoisting example image

7. Block-level declaration, Block-Binding

Block-level declarations are those that declare variables that are inaccessible outside of a given block scope. Block scopes are created:

  1. Inside of a function
  2. Inside of a block (indicated by the { and } characters)



  1. it al time can use

2. var is a function scope inside the function area it can call



var myVariable=“This is var”;




  1. if have possibility to change the variable name then use the let l

example :

let patient=20;



let letVariable=“this is let”;



2. let is block scope it only work in block area not other


1 .if variable value do not have to chance to change in next that time use the


2. const fix no change


const country=“Bangladesh”;


8 .Function default parameter

when call the function if do not given parameter but we want to run the code that’s why use default parameter


default parameter image

9 .Spread Operator

spread operator (…)

  1. The spread operator allows an expression to be expanded in places where multiple arguments (for function calls) or multiple elements (for array literals) are expected.

2. using spread operator do concatenate work easily


Spread operator image

10. Arrow function

An arrow function expression is a compact alternative to a traditional function expression but is limited and can’t be used in all situations.

arrow function

in arrow function minimum if there are two parameter use ()

*Multiline arrow function

multiline arrow function