Typescript Iterate Through Array Javascript Splice Method In Js