JavaScript Spread Operator

Free Web development courses with real-time projects Start Now!!

Program 1


           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]
        //    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(
            //    console.log([])
              // display(  //Spread operator
            //    console.log("--------------------")
            //    display(10,20,30,40,50)
       <h1>Check error in code</h1>


Did you like our efforts? If Yes, please give DataFlair 5 Stars on Google


Leave a Reply

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