Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript and the DOM (Retiring) Responding to User Interaction Functions as Parameters

"Function statement turned into function expression." Doesn't he mean Function *declaration* into function expression?

So I took the advice of the video and checked out the teacher's notes to better understand the difference between a function statement and a function expression. However the link for "function statement" took me to "function declaration" on MDN. From what I understand, a "function statement" is nothing more than the body of a function - the code between the {} brackets. On the other hand, a function declaration is, well, what we have been using since we first learned functions in the beginning JavaScript courses.

So did I miss something, or did the teacher misspeak? Because it looks like in the video he actually turned a function declaration into a function expression, not a function statement into a function expression like he said.

Of course, to me, the example he was describing didn't look quite like any of the three exactly, but I chalked that up to my own limited experience and based my assumption on what looked closest to a declaration/expression based on what I know and what I just read.

Thank you in advance.

Diana Le
Diana Le
6,794 Points

I think he's using the terminology "function declaration" and "function statement" interchangeably. The MDN documentation also uses the terms this way.

The function declaration (function statement) defines a function with the specified parameters.

I know it's confusing because some resources online will write "statements" as being the body of the function within the curly braces.