Asurion Interview Question

javascript and typescript problem that is average in difficulty