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

Need help.

What am I supposed to be passing when I call the function?

script.js
const greet = (name = 'cool coders') =>{};

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

greet('');

2 Answers

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,850 Points

const greet = (name = 'cool coders') =>{}; // remove this

const greet = ('val') => { // you are passing a string (remove quotes) return Hi, ${val}!; }

greet(''); // pass any string value

Steven Parker
Steven Parker
231,269 Points

The call was already provided, you only need to move it after the function definition (since arrow functions are not hoisted).

But in the definition itself, the parameter should not be enclosed in quotes. You also don't need parentheses when there is just one parameter, but they don't hurt if you leave them.