Typescript Dynamic Key Value Javascript Array Slice Method In Javascript