mercredi 28 janvier 2015

Looping though unique keys

I have a json object which I would like to loop through; however each object has a nested object which I can't access through dot notation due to the values being unique.


enter image description here



.__proto__


will give me consistent results; however I'd like to pull out the values starting with the "-Jg". Is it possible to do this through a regular expression or another method?


Edit:


I'm looping through the 'javascript object' with angular



var lognew = [];

angular.forEach(log, function(value, key) {
if(value){
if(value.substr(0,3) !== "-Jg" ){
this.push(value);
}
}
}, lognew);

console.log(lognew);


This currently returns:



TypeError: undefined is not a function

Aucun commentaire:

Enregistrer un commentaire