Created
March 28, 2018 03:35
-
-
Save jasp402/d635b263e7d4dc8b79524fdf43d9c41a to your computer and use it in GitHub Desktop.
Multiplica todos los valores de un array de arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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