Q:

JavaScript: how to return the first letter of each word in a string

I have this const:
const animals = ['Hen', 'elephant', 'llama', 'leopard', 'ostrich', 'Whale', 'octopus', 'rabbit', 'lion', 'dog'];

and I'm trying to return the first letter of each word. 
What I have:
const firstLetter = animals.map(animal => {
return_

A:

Within the handler of the function map destructure the string for getting the first letter and use it as a result for each index. 

const animals = ['Hen', 'elephant', 'llama', 'leopard', 'ostrich', 'Whale', 'octopus', 'rabbit', 'lion', 'dog'];
const result = animals.map(([letter]) => letter);
console.log(result);
.as-console-wrapper { max-height: 100% ! important; top: 0; }

