-1

I've been grappling with this issue for about an hour now, here is the offending code:

const t = games[0];
for (const mvar in t) {
    if (t.hasOwnProperty(mvar))
        console.log(`${mvar}: ${t.mvar}`);
}

The output is:

appid: undefined
name: undefined
playtime_forever: undefined
img_icon_url: undefined
img_logo_url: undefined
has_community_visible_stats: undefined

However, the WebStorm debugger says this value is not undefined as such: enter image description here

Are there any other reasons that this could be?

llamositopia
  • 724
  • 5
  • 11

1 Answers1

7

t has no property named myVar.

You want t[myVar] to get the property with that name.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964