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

I keep getting an error message on Task 2 that says 'Task One No longer passing'

After step one I get to step 2 and my code for step one no longer works. What am I doing wrong?

  var anonymousFunction = function() {
    (function(){
    window.didExecute = true' execute;
    })();

3 Answers

The second question isn't related to the first anonymous function, but the one below it.

All you need to do is separate your anonymous functions by finishing var anonymousFunction = function () { with the closing curly brace, and a semi-colon, and your code should work. Also remove the stray apostrophe after true.

Philip Cox
Philip Cox
14,818 Points

This passes. As Bryan said, don't relate the two questions. I think the first exercise is making sure you understand how write an anon function.

      var anonymousFunction = function() {};

      (function () {
        window.didExecute = true;
      })();

Awesome, thanks to both of you!