JavaScript Spread Operator

Full Stack Web Development Courses with Real-time projects Start Now!!

Program 1

<html>
    <head>
        <script>

           var a=[10,20,30,40,50]
           var b=[100,200,300,400,500]
           
        //    var c=a.concat(b)
        //    console.log(c)
          var c=[ ...a, ...b]
          console.log(c)
           
        //    var b=[...a]
        //    //console.log(b)
        //    a.push(600)
        //    console.log(b) 
          
          

         
            //   function display( ...args)  //rest operator
            //   {
            //           console.log(args)
            //   }

            //    var ar=[10,20,30,40,50,60,70,80]

            //    console.log(...ar)
            //    console.log([...ar])
              // display(...ar)  //Spread operator
            //    console.log("--------------------")
            //    display(10,20,30,40,50)
             
        </script>
    </head>
 
    <body>
      <center>
       <h1>Check error in code</h1>
     </center>
    </body>
</html>

 

You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *