Typescript Array With Key Value Javascript Map Vs Reduce