Shiprocket Interview Question

How to optimize the angular code?