Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.21 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var acumulador = (function(){
  2.     var acumulado = 0;
  3.     return function(ac){
  4.         return acumulado += ac;
  5.     }
  6. }());
  7.  
  8. console.log( acumulador(2) );
  9. console.log( acumulador(5) );
  10. console.log( acumulador(3) );