Typescript Dynamic Key Value Javascript Array Slice Vs Splice