Deloitte interview question

Angular JS code