(ES6) ES6 (2016)

SideEffects (EF01)

   1:  let total = 0;
   2:  const prices = [10, 20, 30];
   3:  
   4:  // Side effect: Modifying the 'total' variable outside the callback
   5:  prices.forEach(price => {
   6:      total += price; // Modifies external state
   7:  });
   8:  
   9:  console.log(total);



1. Modifying External Variables






SideEffects context:






ES6 context:



Comments ( )
Link to this page: http://www.vb-net.com/JavascriptES6/EF01.htm
< THANKS ME>