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

default function parameter

i cant get the write answer

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

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

1 Answer

You're almost there! The correct answer is in your question.

const greet=('cool coders')=>{
  return `hi,${name}`;
}

This part of the code has the string where a parameter should be. However...

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

This arrow function is correct! "val" represents the information that will be passed to the function so we can use it inside the function.

Like this!

greet('cool coders');

Also, with arrow functions, remember that the function call must be after the creation of the function.

So, in order to get this correct, delete the first part and move the function call to after your section function. Then just pass the argument to the function and you're done!

If you need the code, I would be happy to provide it, but give it a shot first! I hope this helps!