IBM interview question

Angular Basics find the occurence in array JS