Typescript Iterate Through Array Javascript Splice Method W3schools