jquery - javascript - Push function to array, loop through and remove after executed -
i trying create array holds pending error messages shows on dom (using jquery that) , loop through array see if there error messages call, , if remove them after executing them. my problem can't figure out how push function array , execute it. have far: var dialogqueue = [] dialogqueue.push(errorcall("test", "test", "test", "test")); (var queuenum = 1, 1 < dialogqueue.length, 1++) { alert(dialogqueue[1]) } and if helps, code showing error messages: function dialogshow() { $(".dialog-con").css("display", "block").css("background", "rgba(0,0,0,.8)") $(".body-wrapper").addclass("errorfilter"); $(".dialog-anim").animate({ opacity: 1, margintop: "-=20px" }) settimeout(function () { $(".errorfilter").addclass("blur"); }, 100); } function dialoghide() { $(".dialo