Javascript Modify Array While Iterating Example Of Thesis