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 Create an Arrow Function

Frederick Bramich
Frederick Bramich
9,757 Points

Need help solving this..

script.js
const greet = ('cool coders') => {
  const val = greet;
  return `Hi, ${val}`;
};

greet('cool coders');

2 Answers

Mark Sebeck
MOD
Mark Sebeck
Treehouse Moderator 37,799 Points

I think inside your greet function you want to make val a parameter instead of 'cool coders'. You pass 'cool coders' into the function. Shouldn't need the "const val= greet" line either

The arrow function can be tricky, in the first line change the "cool coders" to val without the () around it Second Val i assume is standing for value so where the "" set is is where you feed the arrow function the value. you can also get rid of the second line of code. the function to call is greet so at the bottom when you call greet() what you are giving the function in between the parenthesis is the value you are passing to the function. feel free to comment and tag me with any other questions with this :) keep trying!

you should be left with the function looking like this

 const greet = val => {
    return `Hi, ${val}!`;
  }
  greet('cool coders');