I've got object of objects:
let obj = {
  a: {
    af: {
      key: "k", val: "v"
    },
    bf: {
      key: "g", val: "h"
    }
  },
  b: {
    af: {
      key: "f", val: "w"
    },
    nf: {
      key: "u", val: "t"
    }
  }
};`
I'm trying to get an array of all values associated with key - in this case: ["k","g","f","u"]
I tried to use Object.entries() in the for loop but I guess I do not understand how it works. I did simply as in docs:
for ([k,v] in Object.entries(obj)){
  console.log(k,v)
}
but my result is
0 undefined
1 undefined
which I completly do not understand. Could you please help me with explaining how this short code works?
let obj = {a: {af: {key: "k", val: "v"}, bf: {key: "g", val: "h"}}, b: {af: {key: "f", val: "w"}, nf: {key: "u", val: "t"}}};
for ([k,v] in Object.entries(obj)){
  console.log(k,v)
} 
     
    