I am trying to make a numerical value, say 5000, quickly change to another value, say 4000, using JQuery. Right now I do this fine using:
mod(".class",4000,"add");
function mod(id,value,type){
    var numb = $(id).html();
    var current_value = parseInt(numb);
    do {
        if(type == "add")
            increment(id);
        else
            decrement(id);
        current_value = parseInt(numb);
    }while(current_value != value);
    function decrement(id){
        $(id).html(current_value-1);
    }
    function increment(id){
        $(id).html(current_value+1);
    }
}
I know it's probably not the best way to go about it but what I need for it to do is countdown (or up) the numbers very quickly from the current value to the set value. What I intended with this method was to have a delay using setInterval or setTimeout however that makes the whole script fail pretty badly.
Any advice is appreciated, however I would prefer not to use large plugins for this seemingly simple task.