var array = [3, 4, 6, 5, 9, 10, 21]; var divthree = []; var lovethethrees = function (array) { (i = 0; = array.length; i++) { if (array[i] % 3 === 0) { amount.push(divthree[i]); } } }
i learning javascript , having bit of trouble function. can feel im close cant figure out im doing wrong.
there different ways of going (as evidenced other answers here), bug in code posted i = array.length
resetting value of i
. you'll want use <
instead. need push proper array.
var array = [3, 4, 6, 5, 9, 10, 21]; var divthree = []; var lovethethrees = function (array) { (i = 0; < array.length; i++) { if (array[i] % 3 === 0) { divthree.push(array[i]); } } }
Comments
Post a Comment