Advertisement
andreadc

iteration.js

Apr 26th, 2020
605
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function multy(arr) {
  2.     let result = 0;
  3.     arr.map(arr2 => {
  4.         result += arr2.reduce((acc, cur) => {
  5.             return acc != 0 ? acc = acc * cur : acc = cur
  6.         },0)
  7.     });
  8.     return result;
  9. }
  10. const arr = [[5, 6, 4], [2, 3], [1, 2]];
  11. console.log(multy(arr));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement