[solved] Random Quote Machine: Can't print quote from object

[solved] Random Quote Machine: Can't print quote from object
0.0 0

#1

Hi,
I’m completing the random quote machine challenge. I’ve got my quote from an API and i can see it as an object in the console log however when i try to access it via “objectName”.quote i get an undefined. I’m sure it is a simple solution but i’m super stuck can anyone help? Here is the codePen:

Thanks in advance!


#2

Hi, the response data is an Array. you are trying

pull.quote

Instead you need

pull[0].quote

Tiny mistake, you got the whole thing figured out well!! Congrats


#3

As @destrotns points out above, pull is an array. It is an array with only one element, which is why you need the [0] to reference the first element of it.


#4

Ah of course! Thankyou very much, think it just got a bit late last night :stuck_out_tongue: