Hash Function Typescript Interview Question