JavaScript- closure operation

. 1  function makeAdder (A) 
 2  {
 . 3      // here a method returns back 
. 4      return  function (B) 
 . 5      {
 . 6          return A + B;
 . 7      }
 . 8  }
 . 9  
10  // here after performing the method of x became function ( b), can be called 
. 11 the let makeAdder X = (. 5 );
 12 is the let X = SUM (. 6 );
 13 is the console.log (SUM);

 

Guess you like

Origin www.cnblogs.com/sucker/p/11038894.html