Secret Message Iterators 3/7


#1

Can someone explain to me how animals[0] returns the first letter of each word in the array? Whenever I log animals[0] before or after the map function, I get ‘Hen’ which is what I expected. How does the same function return the first character of every string in the array?

let animals = ['Hen', 'elephant', 'llama', 'leopard', 'ostrich', 'Whale', 'octopus', 'rabbit', 'lion', 'dog'];

console.log(animals[0]);

// Create the secretMessage array below

let secretMessage = animals.map(function(animals) {
return animals[0];
});

console.log(secretMessage.join(''));
console.log(animals[0]);

#2

It doesn’t.

The map function is doing the part that is the difference between those two things you described