Amdocs Interview Question

Sample JS code examples and need to optimize that