I need someone to explain this code below, as I have learned about template literal, I thought that the result would be something like this:
my cats are called Pete, my cats are called Biggles, my cats are called Jasmine,
Need help to explain the result from the code below!
const cats = ['Pete', 'Biggles', 'Jasmine'];
let myFavoriteCats = 'My cats are called ';
for (const cat of cats) {
myFavoriteCats = `${myFavoriteCats}${cat}, `
}
console.log(myFavoriteCats); // "My cats are called Pete, Biggles, Jasmine, "