3/7 of .map() under ITERATORS.


I can’t get past 3/7 of .map() under ITERATORS.

How do I refract the code from step 1???


Hello :slight_smile:

You have to post your current code and explain what you already tried. We will be glad to help you.


Hi there! I had the same problem with step number 3.

Here is the code I originally started with when I tried to refactor the first iterator.

let secretMessage = animals.map(message => return message[0]);

But it kept returning an error screen

et secretMessage = animals.map(message => return message[0]);
SyntaxError: Unexpected token return

I pulled some hair out, then I kept reading the error. I noticed that it kept giving me an “unexpected token return” After a slight a ha moment I tried came to the realization that putting in ‘return’ was what was throwing the error.

Therefore I just took ‘return’ out. And voila!

let secretMessage = animals.map(message => message[0]);

This code works.

Not exactly sure how I came to that realization, but analyzing the error screen helped me to eliminate what I now know as unneeded code call.

Hope this helps!