Sollicitatievraag bij Medallia

How would you advise simplifying this code?