Typescript Iterate Through Array Javascript Splice Method In Angular