Whale talk exercise

When I use ‘‘const resultString = resultArray.toUpperCase();’’ I get a SyntaxError while when I use “const resultString = resultArray.join(’’).toUpperCase();” It’s work. somebody can explain me why?

You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

Thanks for asking I hope I can help.

The answer I think is because you are trying to change the case of an array with .toUpperCase() this is a string method so won’t work on an array. In your second line you apply it to a string that’s why it works in the second and not the first.

Here’s a reference for it String.prototype.toUpperCase() - JavaScript | MDN