What are the best practices for adding an object to a javascript array while it is currently in use in an interval method?
function someEvent()
{
array.push("something");
}
function update()
{
array.forEach(function(o, i, a))
{
// do something with the object and delete it
});
}
var updateInterval = setInterval(update, 1000);
This is used in Angular context. I know there are some things in Javascript like calling a function will never call that function before the other function has finished, what applies to interval and the use of arrays like this?