Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript The Problem with Globals

VM527:1 Uncaught ReferenceError: countBirds is not defined

I get the "VM527:1 Uncaught ReferenceError: countBirds is not defined" message in the Chrome console when I enter: countBirds()

Any thoughts on this? Terry

That means there is no function called countBirds() defined

thank you. However, I am using a workspace from the video "The Problem with Globals" the function is defined as such: var count = 0;

function countBirds() { count += 1; return count + ' birds'; }

Yeah, check if you spelled it properly

3 Answers

Joel Kraft
STAFF
Joel Kraft
Treehouse Guest Teacher

Terry, I was able to replicate the issue you describe. It didn't happen every time, but when it did, I simply refreshed the browser and it worked as expected. I'll raise an issue to look further in to this. In the meantime, I hope this helps!

Thank you, and yes I just needed to refresh...

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Hi Terry Cone

I launched the workspace associated with the video and was able to get:

Maybe delete the workspace from the /workspaces dashboard and try again!

Regards,
Andrew

Hi there. If I paste the code into the index.html page I can successfully call the function. Otherwise, the linked script gets me a uncaught error. It works for you, so possibly it is a setting I have in Chrome - at any rate, thank you for looking into this for me. I am a trial user and will not be continuing but thank you again. Terry