Skip to content

Posts from the ‘jQuery’ Category


Using jQuery.each() on a mutating list

Suppose we have a scenario that an array variable (let say ‘master’) contains a list of objects. Each of these objects internally has a reference back to the variable array, so that it’s remove function can remove itself from the owner array.

If we use jQuery.each() to call the remove function on that list, such as:

$.each(master, function(idx, item) {

then it will result with error because we will end up calling the remove function on an object that is already removed. Read more »