angularjs - How to use array include in multidimension array angular 2 -
hi array
this.testarray = [{ "office_id": "1", "officename": "sun" }, { "office_id": "2", "officename": "moon" }];
i want check whether officename sun there or not. tried used include
this.testarray.includes("sun") work 1 dimension array( return true). how if want use multidimension array. return false.
** this.testarray.includes("sun") work array
**
this.testarray = ["sun","moon","stars" }];
it return true exist. not working array one.
your array not multidimensional. can :
testarray.find(function(i){ return (i.officename === 'sun'); });
Comments
Post a Comment