I am iterating through a hashmap, I can see in the console that both the hashmap r
and one if its keys k
is defined (as well as the corresponding value v
):
r
Object {sent020: Object, sent005: Object, sent007: Object, sent002: Object, sent006: Object…}
k
"sent020"
v
Object {org: "someorg", uptime: Object, ip: "10.10.01.1", countryCode: "FR", memory: Object…}
I cannot however access r.k
:
r.k
undefined
I was expecting to find that r.k
is v
. Why isn't it so?
Sorry if this is obvious, I am new to Javascript and the equivalent code in Python yields the expected result:
>>> r = {"sent20": {"org": "someorg", "ip": "10.10.01.1"}}
>>> for k,v in r.items():
... print(k, v, r[k])
...
sent20 {'org': 'someorg', 'ip': '10.10.01.1'} {'org': 'someorg', 'ip': '10.10.01.1'}