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 Getting Started With ES2015 Create Functions Using Arrow Syntax Review JavaScript Arrow Functions

need help on this question

im not sure what would go in the blank

Steven Parker
Steven Parker
231,248 Points

The quiz has multiple questions, please quote the one you're having trouble with.
But none of the questions in this quiz require you to use backticks in the answer.

10 Answers

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

Kenneth Li
Kenneth Li
3,298 Points

const remove = (string,letter) => { let regex = new RegExp(letter, 'g'); return string.replace(regex,''); }

Bad answer

Shay Paustovsky
Shay Paustovsky
969 Points

Hi There,

You are asked to complete the code to create a function expression that creates an anonymous function using the arrow syntax with 2 parameters : string & letter.

It looks like this

const something = ( ) => {

}

Now I will give you guides on how to create an anonymous function using arrow syntax.

  1. Parenthesis cannot be omitted if the function doesn't take any parameters
  2. If the function accepts one parameter you can ommit the parenthesis.
  3. If the function only has 1 line of code that it executes and immediatly returns a value, then " { } " and " return" can be omitted
  4. If the function has 2 or more parameters, parenthesis can't be omitted.

Good Luck

Shay

Steven Parker
Steven Parker
231,248 Points

Just a guess, but if you're on the question about passing parameters note that when two or more parameters are being passed they should be enclosed in parentheses.

So for that question, the blank needs to have a set of parentheses containing both parameter names separated by a comma.

Complete the code below to create an arrow function with two parameters — string and letter — const remove = => { let regex = new RegExp(letter, 'g'); return string.replace(regex,''); }

Steven Parker
Steven Parker
231,248 Points

I guessed you might be on that one. See the answer I already posted.

whats the actual annswer

i don't know i was wondering the same thing.

asap

i already got it wrong

what do we do on the number one??

The answer is greeting,name used that to pass

Complete the code below to create an arrow function with two parameters — string and letter — const remove =(string, letter) => { let regex = new RegExp(letter, 'g'); return string.replace(regex,''); }