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 trialTrue Andrews
Front End Web Development Techdegree Student 10,520 PointsNeed help.
What am I supposed to be passing when I call the function?
const greet = (name = 'cool coders') =>{};
const greet = ('val') => {
return `Hi, ${val}!`;
}
greet('');
2 Answers
Clayton Perszyk
Treehouse Moderator 48,850 Pointsconst 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
231,210 PointsThe 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.