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 JavaScript Foundations Functions Anonymous Functions

Annika Noren
Annika Noren
26,930 Points

JavaScript Foundations: anonymous functions - challenge task #2

I just can not figure out what is wrong with my code.

This is what I have:

16 var anonymousFunction = function(){ 17 }; 18 19 anonymousFunction(function(){ 20 window.didExecute = true; 21 });

The error says I am missing a parentheses at end of function.

Thoughts? Probably something so minor....

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Annika;

I found this task to be poorly worded. All you need to do is add () at the end of line 20 before the semi-colon. That allows the window.didExecute = true; to execute.

Ken

Annika Noren
Annika Noren
26,930 Points

Thank you, Ken.

Yes, it was poorly worded and confusing! I was definitely overthinking it.

Thank you so much for your response!