jquery - javascript pass argument to object.keys -


i have object contains things i'm looking for:

exclusions

1: object [ id: "38433" , location: "central"] 2: object [ id: "43434" , location: "west"]

and have object called schools contains set of things: using object.keys() method loop through object, need pass in location search search in central, or west,etc. if try (schools.district.location) error. how pass in correct argument object.keys function?

part2: correct way remove element array. need remove location[15] if id's match.

code:

$.each(exclusions , function (index, value) {  var location = value.location;  //gives me central, west, east var id = value.id;  object.keys(schools.district.{{pass in location}}).foreach(function (key) {   //each location array of schools need scan each matching id     (var i=0; < {{get length of location array}}.length; i++) {        if(location[i][id] == id)         {           location.slice();  //not sure        }      }   }); 

you want use objects.key ? why dont use for in ?

var result = []; (i in your_object) {     if(your_object[i].location == "what want") result.push(your_object[i]); } 

i guess can not remove property want probably, can set null, , @ end, property not null

edit: delete property on your_object: (i key iterator)

delete your_object[i] 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -