Create a function called
multiplesOf
.
It will accept two arguments, the first will be an array of numbers, the second will be a number.
The function should return a new array that is made up of every number from the argument array that is a multiple of the argument number.
SomultiplesOf([5,6,7,8,9,10], 3)
will return[6, 9]
.
function multiplesOf(numbers) {
var multiples = numbers[0];
for (var i = 0; i < numbers.length; i++) {
if (numbers[i] % multiples === 0) {
multiples = numbers[i];
}
}
return multiples;
}
console.log(multiplesOf([4, 5, 6, 7, 8], 2));
says function is defined in jsbin help please