Learn Modern JavaScript Methods by Building Football Team Cards - Step 25

I have a question about this step, specifically about empty callback functions.

My previous code didn’t pass:

playerCards.innerHTML = arr.map (function( ) { });

I eventually figured it out by passing in another form of empty callback functions.

What I do not understand is:
There seems to be two forms of empty callback functions (unless there is only one form)
Why is the empty callback function as provided above not acceptable in this step?

Challenge Information:

Learn Modern JavaScript Methods by Building Football Team Cards - Step 25

playerCards.innerHTML = arr.map (function( ) { });

This is wrong formation of a call back function. It’s Have a extra function word and missing aero => after empty () parentheses.
@Katerevrie

As I understood it,

( ) => { } and function () {} are two types of functions that can be used as an empty callback function.

The first type is called an arrow function. The second is called a regular function. Both can be used as an empty callback function.

My question was, why is the first kind not recognized as admissible for THIS step of the tutorial project.

If you mean an empty callback function can only use an arrow function, could you provide me with the documentation or source of this information? Because I read that both functions can be used as callback functions.

Thanks.

1 Like

The map method accepts regular functions in addition to arrow functions.

Here is a codepen example using different ways to use map with callbacks

because it is a bug in the tests.

The tests were written to only accept arrow functions

I created an issue here

Thanks for the clarification.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.