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 trialEric Jusic
4,350 PointsIs there any other difference between function and anonymous function?
Is there any other difference between function and anonymous function than ones stated in the video?
Or are they completely same, and choosing between them come down just to preference?
2 Answers
Steven Parker
231,268 PointsNormally you would choose based on what suits the purpose. For example, when creating a callback that is not used anywhere else you might build an anonymous function as the argument of the call that uses it. And a function to be re-used in multiple places in the program would be a named function.
But there's no difference in the way the functions operate.
Eric Jusic
4,350 PointsOk great, that is what I wanted to clear out :)
Thank you, Steven, for your help, really appreciate! :)
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 PointsAakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 PointsCan you please elaborate it more Steven . I didn't got that what you said. I got the second part about "named function" what didn't understood what you said about anonymous function . Waiting for you reply.