ECMAScript 6

ECMAScript is new standard of javascript verispn with lastest feature, it provides a more concise syntax in ES6.
Also known as ECMAScript 2015, is the latest version of the ECMAScript standard.
ES6 is a significant update to the language, and the first update to the language since ES5 was standardized in 2009.

Arrow Function

                  
                        const showUser = () => {
                          const name = "Ram and Hanuman";
                          return name;
                        }
                        const data = showUser();
                        console.log(data);
                  
                

Spread Operator

Spread operator allow us to copy all or part of an existing array or object into another array or object.
                  
                    const x = [1,2,3,4,5];
                    const y = [5,6,7,8,9,10];
                    const data = [...x, ...y];
                    console.log(data);
                  
                

Rest Operator

The rest operator or parameter allow us to represent an array indefinite number of arguments as an array.
                  
                      // Eaxmple 1
                      function show(...rest){
                        let data = rest;
                        console.log(data); // ["Saten Pratap", 2, "Ram", 12, "Banglore"]
                      }
                      show('Saten Pratap', 2, 'Ram', 12, 'Banglore');
                      // Eaxmple 2
                      function show(name, ...rest){
                        let data = rest;
                        console.log(name); // 'Ram'
                        console.log(data);  [2, "Ram", 12, "Banglore"]
                      }
                      show('Ram', 2, 'Sham', 12, 'Banglore');
                  
                

Destructuring

Destructuring means we can extract data or item from array, object and props, store them in a separate variable
Array De-structuring
                  
                    const users =['Ram','Sham','Hanuman'];
                    const [r,s,h]= users;
                    console.log(r); // "Ram"
                    console.log(s); // "Sham"
                    console.log(h); // "Hanuman"
                    const {...item} = users;
                    console.log(item) // { 0: "Ram", 1: "Sham", 2: "Hanuman" }
                  
                
Object De-structuring
                  
                    const users ={name:'Ram',city:'Ayodhya',state:'UP' };
                    const {name, city, state}= users;
                    console.log(name); // "Ram"
                    console.log(city); // "Ayodhya"
                    console.log(state); // "UP"
                  
                
Props De-structuring
                  
                    function show(props) {
                      const {name, city, state}= props;
                      console.log(name); // "Ramayan"
                      console.log(city); // "Ayodhya"
                      console.log(state); // "UP"
                    }

                    const data ={name:'Ramayan',city:'Ayodhya',state:'UP' };
                    show(data);
                  
                

Template Literals

Template string, also called as template literals, is a new feature in JavaScript that allow us for string interpolation and multi-line strings. IT is denoted by backticks (`) instead of single or double quotes.
                  
                    const data ={name:'Ram',city:'Ayodhya',state:'Uttar Pradesh' };
                    console.log(`My name is ${data.name} from ${data.city} ${data.state}`)
                  
                

Var, Let and Const

                  
                    //var is global variable and window object
                      var data = "China"; //  This is window object it can be used anywhere
                    //let is not global variable 
                      let x = 10;
                      let x // can not redeclare and can update
                    //const is constant variable type
                      const y = 12;
                      let y // // can not redeclare
                    // Block scope 
                      function show(){
                        let a = 12;  // blocked scope variable,can not use outside of function
                        let name = 'Ram'; // blocked scope variable, can not use outside of function
                        console.log(a);
                        console.log(name);
                      }
                  
                

New Set

                  
                    //Find unique elements
                    var data = [1, 3, 5, 7, 9, 3, 1, 5, 11, 4, 13, 7, 11, 9, 13];
                    var num = [...new Set(data)];
                    console.log(num);;  
                  
                

IIFE (Immediate Invoked Function Expression)

Immediate Invoked Function Expression, self executing anonymous function and it contain two parts.
                  
                    //Example 1
                    (function(){console.log('My name is Saten Pratap');})();  // "My name is Saten Pratap"
                    //Example 2
                    (function(a,b){console.log(a+b);})(12,18);  // 30
                    //Example 3
                    ((a,b)=>{console.log(a+b);})(10,12);     // 22