I've checked other responses and couldn't figure this out. I can't tell if the data I'm getting back is just in correct or if my loop is not right. I'm trying to access the values of this array in my response.
Using a node library I'm accessing Zillow api with this code:
const Zillow = require("node-zillow")
const zillow = new Zillow('my key')
const parameters = {
address: "5555 Ronald Road",
citystatezip: "South Gate, CA",
rentzestimate: true
}
zillow.get('GetSearchResults', parameters)
.then(results => {
console.log(results)
return results
})
This returns the following:
{ request: { address: '5555 Ronald Road', citystatezip: 'South Gate, CA' },
message: { text: 'Request successfully processed', code: '0' },
response: { results: { result: [Array] } } }
My problem is I'm unable to access the data in the Array. I've never used Node before so I'm confused as how to do it.
I try adding this:
for (let item of results) {
console.log(results)
}
Since it's an array I figured I could do this console.log(results[0]) this returns undefined.