Skip to content

Instantly share code, notes, and snippets.

@jasp402
Created March 28, 2018 03:35
Show Gist options
  • Save jasp402/5e2c4e984516fd8a287157bae5fd8d7b to your computer and use it in GitHub Desktop.
Save jasp402/5e2c4e984516fd8a287157bae5fd8d7b to your computer and use it in GitHub Desktop.
Multiplica todos los valores de un array de arrays
const mutiplyAll=arr=>{let r=[];arr.forEach(x=>{x.forEach(y=>{return r.push(y)})});return r.reduce((acc, n) => n * acc)};
console.log(mutiplyAll([[1,2], [3,4], [5,6,7]])); //5040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment