Author: Not specified Language: javascript
Description: Not specified Timestamp: 2018-04-17 08:52:24 +0000
View raw paste Reply
  1. var sample = [1, 2, 3] // here we meet again
  2. // es5
  3. var sum = sample.reduce(function(sum, elem){
  4.     return sum + elem;
  5. })
  6. // es6
  7. var sum = sample.reduce((sum, elem) => sum + elem)
  8. console.log(sum)
View raw paste Reply