Last active
July 25, 2018 21:28
-
-
Save funador/df8e25749bee7116eeaf8795727e9202 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 arrToManipulate = [3, 5, 9, 2] | |
| const atIndex2 = arr => { | |
| let total = 1 | |
| const retArr = [] | |
| for(let i = 0; i < arr.length; i++) { | |
| total *= arr[i] | |
| } | |
| for(let j = 0; j < arr.length; j++) { | |
| retArr.push(total / arr[j]) | |
| } | |
| return retArr | |
| } | |
| atIndex2(arrToManipulate) // [90, 54, 30, 135] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment