Typescript Get Last Element Of Array Js Delete