Typescript Array Distinct Javascript Interview