Having some minor problems with a loop I'm doing. It doesn't seem to be running, even though all the conditions should be met...
Code:
for (var i = 0; i > obj.length; i++) {
console.log(i);
if (obj[i]["val3"] === true) {
objReturned = obj[i]["val2"];
}
}
console.log(objReturned);
Simple enough right? Here's how the object roughly looks, I've tried debugging by logging contents of the JSON obj, and I am successfully in retrieving any value using the object notation (eg. obj[0].Active).
It's just NOT working in my loop? Am I forgetting something here?
[
{
"val1": "organisationname1",
"val2": 1,
"val3": true
},
{
"val1": "organisationname2",
"val2": 2,
"val3": false
},
{
"val1": "organisationname3",
"val2": 3,
"val3": false
}
]