The goal was to get the first letters of the items in the array to be capitalized but it's printing out undefined
const words = ["planes", "trains", "automobiles"];
const singularWords = words.map(w => w.slice(0, -1))
// The below line should console.log: ["plane", "train", "automobile"]
console.log(singularWords);
// Bonus:
const capitalizedWords = words.map((w) => {
for (let i = 0; i < words.length; i++) {
words[i] = words[i].charAt(0).toUpperCase();
}
});
// The below line should console.log: ["Planes", "Trains", "Automobiles"]
console.log(capitalizedWords);