I need to iterate through an object and get to the sub-objects.
I am able to get list1 correctly (___grecaptcha_cfg.clients[0])
but list2 (___grecaptcha_cfg.clients[0].l) returns “undefined”
If I were to run “___grecaptcha_cfg.clients[0].l” via Dev Tools it returns an output, but via the code it returns “undefined”
The webpage is “https://www.freepik.com/profile/login”
Here is my code:
let list0 = ___grecaptcha_cfg.clients
for (let item1 of Object.keys(list0))
{
let list1 = ___grecaptcha_cfg.clients[item1]
console.log(list1);
for (let item2 of Object.keys(list1))
{
let list2 = ___grecaptcha_cfg.clients[item1].item2
//console.log(item1);
console.log(item2);
console.log(list2);
//break;
}
break;
}
item2 is generated via the script. It is not Literal. I need to iterate through the object and subobjects to find the correct one. See script above. Thanks
list1 is generated in a similar way and that resolves correctly. See screenshot in main post. If there is a different way to get list2 then what should I put in the code? Thanks
in one case you use dot notation, the other bracket notation -dot notation will access literally the variable with that name so you can’t use it with variables