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 Interacting with the DOM Responding to Events Functions as Parameters

JOE BELL
JOE BELL
11,113 Points

Not a question. Treehouse, you need to fix the error in the video. from 3:20. .

Not a question. Treehouse, you need to fix the error in the video. from 3:20.

2 Answers

I think that the issue JOE BELL refers to is this piece of code:

hiAndBye(function ()=>{
    console.log("Hello")
})

which is described in 3:25 as an anonymous function. Later on, the teacher deletes function and runs the code, which of course works.

So, it seems to me that JOE BELL wanted to point out this particular moment, where an incorrect way of writing a function (function ()=>) is described also incorrectly as an anonymous function, and finally the actual function written is and executed is an arrow function.

Steven Parker
Steven Parker
229,644 Points

The recommended procedure for reporting a course but to the staff can be found at the top of the Support page If they agree and you are the first to report it, it will get you a "special Exterminator badge". :beetle:

And you might want to be a bit more specific about exactly what the error you found in the video was.

JOE BELL
JOE BELL
11,113 Points

Hi Steven. Thanks for the reply. I didn't know that and now glad you pointed that out. I had tried to report it but with no luck which is why I posted the comment with the hope that a staff member would read and act on it.

Steven Parker
Steven Parker
229,644 Points

I don't know if the staff always reads the forum posts, but they should definitely see anything you email to the support address. Did you explain what the error was? I couldn't see anything wrong in the video myself.

Steven Parker
Steven Parker
229,644 Points

After seeing Pere's note I agree that the video is problematic.

There are two ways of writing anonymous function expressions, but the instructor pauses at the wrong moment to identify it. The first type uses the word "function" and would look like this:

hiAndBye(function () {

The second type is with an arrow function which the instructor eventually creates and looks like this:

hiAndBye(() => {

It's not clear why he would change from one type to the other, but the fact that he pauses midway through the conversion and describes it, and then makes a change to another line before returning and finishing, is most definitely confusing and probably needs at least some explanation in the "Teachers Notes" section.