I have a javascript for loop
iterating through an array of elements and adding a class to them, then remove the class ro change the color of the element for one or two seconds and then revert it to the previous color. I need a synchronous wait in the code between add and remove, which pauses the for loop
and do nothing to show the color, or else changing class will not be affected.
for (var i=1; i<array.length; i++){
array[i-1].addClass('something');
array[i].addClass('something');
//WAIT, PAUSE THE LOOP for two seconds
array[i-1].removeClass('something');
array[i].removeClass('something');
}