Functional Programming: Use the map Method to Extract Data from an Array

I saw the solution to this question in the hints. But does anyone know how to write this using the function keyword syntax as opposed to the arrow function?

Thank you,

A link to the challenge might be useful.

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array

Yes, it’s possible to write it using the function keyword, but what are you struggling with? Is your problem that you don’t know how arrow functions work, or you don’t know how the function keyword works?

I basically understand how arrow functions work. I finished the es6 section earlier. I know arrow functions to a certain extent replace the function keyword. I only ask because I did some Javascript programming a ew years back and there were no arrow functions back then. I just wanted to see the old syntax again.

[1, 2, 3, 4, 5].map(n => n * n);

Become this:

[1, 2, 3, 4, 5].map(function (n) { return n * n; });