Start ES6 today to get you settled

rafee abdullah
3 min readMay 6, 2021

Arrow Function:

Arrow function is an alternative way to declare regular function expressions in javascript. Traditional Function need the keyword funtion to declare any function but arrow function is somewhat like declaring a variable and initializing the value with the function arguments.

const namePrint () =>{

console.log(“Name”)

}

Spread Operator(…):

It allows an iterable to expand in places where 0+ arguments are expected. It is mostly used in the variable array where there is more than 1 values are expected. It allows us the privilege to obtain a list of parameters from an array.

let arr1=[1,2,3,4];

let arr2=[6,7,9];

const arr =[…arr1,…arr2]; // returns [1,2,3,4,6,7,9]

Hoisting:

Hoisting is a term that makes the process of using the variable and function before it is declared. Before ES6 it was strict to code management that the variable and the function is to be declared at the top of the code and then the variable and functions are used anywhere of the code. But in ES6 there is no rule like this. One can use any function / variable anywhere then declare it later on in the code.

Block Level Function:

Block level function is defined as the function declared in a certain scope or block . Variable declared wit let and const are bound within the scope only. Functions declare in a block in also accessible only in that certain block. The block is bound with {}

JavaScript Errors and handle:

When you are in the coding table writing a tons of lines of code it is pretty obvious you to some mistakes. Sometimes you forget to write proper expression, proper declaration. Therefore, errors come in your code. In javascript there is a method to handle errors. That is called

try{}catch{}..

This method is used to detect the runtime error we make in JavaScript coding.

Works as:

try{

//lines of codes

console.log(“compiled successfully”);

} catch{

console.log(“Error Found recheck please”);

}

This is how try catch method work to catch the errors in js code .

Default Function parameters:

JavaScript functions parameters are usually undefined. But when the function is called if some parameters are not defined then the function got some errors. Thats why sometimes some default parameters are assigned with values in function declaration. Like..

function(a=1,b=5){

console.log(a+b);

}

Coding Style:

When you code to design and built a app. It is not you the only person who will always work alone on the same code. There is always a team working behind an website/app. So you code should be cleaner enough so that other person working on the same project get a clear vision of what you wrote and tried to implement. So that other programmer can get it and make changes to the existing project.

Comments in code:

Comments are very important while you are coding. You write what you thought and the block of code is doing. But excessive comments make your code looks uglier.

ES6 Block Bindings:

Block Bindings is a special feature that let you have a clear vision about the block, its working area and the variable scopes. Before ES6 was launched we used to use var to declare a variable. But now we use let to declare. But there are differences between let and var. let works in a block ,if you call it outside of a clock you will get an error. But var works globally. That makes your code pretty slower and memory management get large.

Cross Browser Testing:

Cross browser testing refers to the term that you make a website / webapp that runs in all browsers efficiently. Sometime it is not possible to make it affordable for all browser but need to ensure that a most number of browser can hold it perfectly.

Why does cross browser issues happen:

  1. Some browsers support different level of implementation and support for different technology.
  2. Some device may have constrains that make the website kind of slow that other browser does.
  3. Some browsers have bugs in their features that why this kind of incident occurs.

--

--