Webz.io interview question

How you can improve the code of the assignment?