Help with Code on Unit 5 Hackathon project

Can someone help me figure out why the variable is undefined on line 40 when it defined on line 26?

Thanks

Just looking quickly at your code, what I see is that you call getRandomFossil(); on line 22 of your code. That is before you declare the variable on line 26. It is best practice to declare all your global variables at the top of your program.

Thanks. I appreciated it and figured it out