Skip to content

Instantly share code, notes, and snippets.

@LSStaff
Created August 28, 2018 13:43
Show Gist options
  • Save LSStaff/f9ca1e99255cd1bdc1a5064fa8cdff05 to your computer and use it in GitHub Desktop.
Save LSStaff/f9ca1e99255cd1bdc1a5064fa8cdff05 to your computer and use it in GitHub Desktop.
var dividend = 18;
var numbers = [2, 3, 4, 5, 6, 7, 8, 9];
var idx;
for (idx = 0; idx < numbers.length; idx++) {
var factor;
var divisor = numbers[idx];
if (dividend % divisor === 0) {
factor = true;
}
if (factor) {
console.log(divisor + ' is a factor of ' + dividend + '!');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment