Angular Minds interview question

I was not able to pass coding test