just a quick question. How can I retrieve elements in an array given that the elements cannot be divided by other elements in an array? for example= arr =[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
and collection =[2,3,5,7]
, then the result would be result =[11,13]
I have tried with this code , but it didn't work
for(var i=0; i<arr.length;i++){
for (var j=0; j<collection.length; j++){
if (arr[i]/collection[j] === 0){
arr.splice(i,1);
}
}
}