Created
June 8, 2017 00:05
-
-
Save mbcarruthers/92192bc5ee47b086ec3033da9f7bfa3a to your computer and use it in GitHub Desktop.
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
let array1 = [1,2,3,9]; | |
let array2 = [1,2,4,4]; | |
//make a program that goes through each of these arrays and can | |
//return to you whether 2 numbers add to equal 8 | |
for(let i = 0;i<array2.length;i++) { | |
for(let j = 0;j < array2.length;j++) { | |
if(array2[i] + array2[j] === 8) { | |
console.log(array2[i] + ' and ' + array2[j] +' add to equal 8'); | |
} else { | |
console.log(i + ' and ' + j + ' do not equal 8 '); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment