You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Oh sorry just realised that your json is an array not an object. Most of the above still applies, but you don't need the Object.keys etc. You can just map over the array directly with json.map(item => item.common_name)
week4-team-pokedex/src/getCommonNames.js
Line 3 in 39d14ef
I think you've hardcoded
24698
here because that's how many properties are in the JSON?If you need to loop over an object there are a few options:
for
loop but usejson.length
instead of hard-coding the number.for..of
loop which will loop over an object directly.Object.keys(json)
,Object.values(json)
orObject.entries(json)
e.g.
The text was updated successfully, but these errors were encountered: