-->

  • ES6 Spread operator in javascript

     

    ES6 Spread operator in javascript

     

     Spread Operator

     

    Spread syntax allows arrays and objects to be expanded into :

    - elements in case of array.
    - key-value pairs in case of object.



    ES6 is different version of the ECMAScript specification. Which is the standard that defines the scripting language that javascript is based on.

    ES6 release on 2015 and there are so many features Arrow function, classes, let and const for variables.


    For use copy iterable object (...) allows is to quickly copy all or part of an existing array or object into another array or object.

    Actually we have used this code in reactjs called as TheArrow.jsx

     

    Example


     

    import React from 'react'
    
    function TheSpread() {
    
        let myarr1 = [1, 2, 3, 4, 5, 6];
        let myarr2 = [7, 8, 9, 10, 11, 12];
        let myarr3 = [...myarr1, ...myarr2];
    
        console.log(myarr3);
    
    
      
      return (
        <div>
        
        <h1>Check Console</h1>
        
        
        </div>
      )
    }
    
    export default TheSpread
    

     

     

     

    Output

     

     

    ES6 Spread operator in javascript

     

     


    Disclaimer

     

    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.


     

  • 0 comments:

    Post a Comment

    For Any Tech Updates, Hacking News, Internet, Computer, Technology and related to IT Field Articles Follow Our Blog.