(numArray)
| 24 | */ |
| 25 | |
| 26 | function adjacentSum(numArray) { |
| 27 | // your code here |
| 28 | let sumArr = []; |
| 29 | |
| 30 | for(let i = 0; i < numArray.length; i++) { |
| 31 | |
| 32 | // console.log('Hi!') |
| 33 | let currNum = numArray[i]; |
| 34 | // console.log(currNum) |
| 35 | let nextNum = numArray[i + 1] |
| 36 | // console.log(nextNum) |
| 37 | |
| 38 | if (nextNum === undefined) return sumArr; |
| 39 | else sumArr.push(currNum + nextNum) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // console.log(adjacentSum([3, 7, 2, 11])); // [10, 9, 13], because [ 3+7, 7+2, 2+11 ] |
| 44 | // console.log(adjacentSum([2, 5, 1, 9, 2, 4])); // [7, 6, 10, 11, 6], because [2+5, 5+1, 1+9, 9+2, 2+4] |
nothing calls this directly
no outgoing calls
no test coverage detected