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:

Hi, I am working on the CODE CHALLENGES: INTERMEDIATE JAVASCRIPT shoutGreetings() one, link:

I write two ways to solve the problem using map and forEach, But none is working. Could someone explain my problem why i am getting undefined?

// Write your code here:

const shoutGreetings = arr => => word.toUpperCase() + '!');

const shoutGreetings1 = function(arr) { (function(element){

    return element.toUpperCase() + '!' 



const shoutGreetings2 = function(arr) {

  const newarr = [];


    newarr.push(element.toUpperCase() + '!')



// Feel free to uncomment out the code below to test your function!

const greetings = ['hello', 'hi', 'heya', 'oi', 'hey', 'yo'];


console.log(shoutGreetings1(greetings)); //undefined

console.log(shoutGreetings2(greetings)); //undefined

// Should print [ 'HELLO!', 'HI!', 'HEYA!', 'OI!', 'HEY!', 'YO!' ]

hi @css7076515896 ,

you forgot to return them for both the functions wrote.


one: return the execution process

two: return the variable