Tweet problem in Random Quote Machine

Hi guys! I am almost finished with my random quote machine. However, when I try to click my tweet element, my tweet opens up as “undefined”. Can someone help to explain why my randomQuote does not open correctly in the tweet? Thanks.

Thats because you are calling a variable that is in a local scope to your function getQuote(). So when you call the variable in the twitter button, that variable hasnt been defined yet.

Yep, that was it. Thank you.

1 Like

Well i didnt scroll all the way to the top, but you two variables named the same. One in the global which is assigned to nothing and the other in the local state of the function assigned to the generated quote. *

Your welcome!