Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
215,370 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
215,370 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
215,370 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

Kavitha Mahesawarappa Sujatha
Kavitha Mahesawarappa Sujatha
9,065 Points

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,''); }