I am trying to get jQuery to remove an element after it as run through a cycle of other functions, but following code block executes the remove() before it has run any of the for loop.
function waves(){
for(i=0;i<=10;i++){
wave(x);
};
$(x).remove();
}
wavefunction is some kind of async function. It's interesting to see the full code