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 trialConner Mack
7,309 Pointsneed help on this question
im not sure what would go in the blank
10 Answers
Larissa Ragland
6,653 Pointsanswer:
const sayGreeting = (greeting, name) => {
return ${greeting}, ${name}.
;
}
Kenneth Li
3,298 Pointsconst remove = (string,letter) => { let regex = new RegExp(letter, 'g'); return string.replace(regex,''); }
Omar Ocampo
3,166 PointsBad answer
Shay Paustovsky
969 PointsHi 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.
- Parenthesis cannot be omitted if the function doesn't take any parameters
- If the function accepts one parameter you can ommit the parenthesis.
- If the function only has 1 line of code that it executes and immediatly returns a value, then " { } " and " return" can be omitted
- If the function has 2 or more parameters, parenthesis can't be omitted.
Good Luck
Shay
Steven Parker
231,275 PointsJust 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.
Conner Mack
7,309 PointsComplete 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
231,275 PointsI guessed you might be on that one. See the answer I already posted.
Maycey Davis
2,792 Pointswhats the actual annswer
Madason Snodgrass
2,727 Pointsi don't know i was wondering the same thing.
Maycey Davis
2,792 Pointsasap
Maycey Davis
2,792 Pointsi already got it wrong
Amyah Aboytes
2,234 Pointswhat do we do on the number one??
Alexandria Brownlee
2,404 PointsThe answer is greeting,name used that to pass
Kavitha Mahesawarappa Sujatha
9,066 PointsComplete 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,''); }
Steven Parker
231,275 PointsSteven Parker
231,275 PointsThe 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.