-4

So I have an array which looks something like:

["image", "image_link", "images_carousel", "images_collection", "video", "video_carousel", "video_collection", "video_link"]

I need to capitalise the first letter of each word and remove the "_" between some words. I've managed to do it for a string but I can't get it for this array. some help? Thanks.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339

1 Answers1

0
yourArray.map(word => `${word.charAt[0].toUpperCase()}${word.slice(1)}`.replace(/_/g, " "));
damnhotuser
  • 66
  • 1
  • 3