Extended merge array operator

  <Script>
       // merge array 
       the let of arr1 = [11,22,33,55 ]; 
       the let arr2 is = [ "AA", "BB", "CC", "dd" ];
       //   ES5 merge 
      the let = ARR of arr1 .concat (arr2 is); 
      the console.log (ARR) //  [. 11, 22 is, 33 is, 55, "AA", "BB", "CC", "dd"] 
      
      // merge es6 of 
      the let newarr = [.. .arr1, ... arr2 is] 
      the console.log (newarr) //  [. 11, 22 is, 33 is, 55, "AA", "BB", "CC", "dd"] 
      

     

      // internal function has an object, arguments argument can be acquired, but a dummy array 
      function Sun () { 
        Console.log(arguments) //Arguments (8) [1, 2 , 3, 4, 5, 6, 7, 9, callee: ƒ, Symbol (Symbol.iterator): ƒ] He is a dummy array 
      } 
      Sun ( 1,2,3,4, 5,6,7,9 ); 
      

      // how the dummy array inside the array method of function becomes true. 1 
        function Sun () { 
        the let AGS = Array.prototype.slice.call (arguments); 
        ags.push ( 150 ) ; 
        the console.log (AGS); // [. 1, 2,. 3,. 4,. 5,. 6,. 7,. 9, 150] 
        } 
        Sun ( 1,2,3,4,5,6,7,9 ); 


          / / how the dummy array inside the array of function becomes true method 2 
          function Sun () { 
          the let AGS = [arguments ...]; // dummy array hundred non-real array 
          ags.push (150); 
          The console.log (AGS); // [. 1, 2,. 3,. 4,. 5,. 6,. 7,. 9, 150] 
          } 
          Sun ( 1,2,3,4,5,6,7,9 ); 

        //   summary is extended operator ... [... to the true object array]
 
    </ Script>

 

Guess you like

Origin www.cnblogs.com/IwishIcould/p/11567768.html