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 trialErin Knapp
Courses Plus Student 8,861 PointsAnonymous Function Exercise
I'm not sure what is expected in the coding challenge. It keeps telling me there is a syntax error and I can't find where the syntax error is. So how should the anonymous function be written for this exercise?
2 Answers
Ken Alger
Treehouse TeacherErin;
In JavaScript you can use the following:
var anonymousFunction = function(){};
Ken
Erin Knapp
Courses Plus Student 8,861 PointsThat's what I thought I was doing. I was just making the exercise more complicated than it was. I was thinking that the two challenges were creating one function instead of two separate anonymous functions. I need to stop over complicating things.
Thanks for your help!
Ken Alger
Treehouse TeacherErin;
No problem!
That is a good thing to remember as you work through most of the challenges here at Treehouse. Follow what the directions for the task are saying and don't try to add additional code to it as often times the challenge validator is rather "picky" about the code it will accept.
Best of luck.
Ken