0

I have this JavaScript function that takes a string and returns first letter of every word in the string.

How can modify function to takes a string, check first letter of every word in the string and return next letter in the alphabet?

function getFirstLetters(str) {
  let words = str.split(" ");
  let firstLetters = words.map(word => word[0]);
  return firstLetters.join("");
}

console.log(getFirstLetters("Hello World")); // "HW"

I need final result IX

Leo Lucas
  • 3
  • 4

0 Answers0