Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Functions Arrow Functions Arrow Functions Review

Angelica Islas
Angelica Islas
4,082 Points

Completing the code with the parameters greeting and name

const sayGreeting = => { return ${greeting}, ${name}.; }

I thought that inserting closed parenthesis () before the arrow would solve this, but I was wrong. Could I have some assistance? Thank you

1 Answer

Hi Angelica!

The giveaway is the fact that you are referencing two variables in the body of the function.

Where did they come from?

They need to be passed in.

Like this:

const sayGreeting = (greeting, name) => {
  return `${greeting}, ${name}.`;
}

And , of course in the real world, you would then call the function something like:

const myGreeting = sayGreeting("Yo", "Angelica");

I hope that helps.

Stay safe and happy coding!