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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -