es6 vs es5

 string concatenation 

firstname + ''+lastname;

`${firstname} ${lastname}';


function declarations
ES5 
FUNCTION sayhello(){
console.log();
};

ES6

const sayHello =() => {console.log();}

template literals

var message = 'Hello,'+name+'!';

es6:

const message = `hELLO, ${NAME}!`;


COMBINE ARRAYS , SPREAD OPERATOR


OBJECT DESTRUCTURING 

DEFAULT PARAMETER VALUES





scopes


Scope in JavaScript
Understanding scope in JavaScript is crucial for mastering the language. Scope determines the accessibility of variables and functions within your code.
Let's dive into the basics:
🎯 Global Scope:
Variables declared outside of any function have global scope and can be accessed from anywhere in your code.
🎯 Local Scope:
Variables declared inside a function have local scope and can only be accessed within that function.
🎯 Block Scope:
Block scope was introduced in ES6.
Variables declared with let and const have block scope, meaning they are only accessible within the block where they are defined (e.g., inside loops or conditional statements).


https://morioh.com/a/effc50cde4db/es6-es10-cheat-sheet-for-developers

No comments:

Post a Comment

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...