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 trialKJ Lee
1,059 PointsI am lost. What would the final code be here?
Anyone know what the final code would be here and why?
greet('cool coders');
function greet(val) {
return `Hi, ${val}!`;
}
const greeting = ('Hi John') => {
return "Hi John"
1 Answer
Steven Parker
231,275 PointsThe hint about "hoisting" lets you know that the new function needs to be first. And since you're "converting", you won't keep the old one.
But the new version needs to do the same job as the original function did, using the same argument and building the same final string using it.
Blake Larson
13,014 PointsBlake Larson
13,014 PointsYou don't have to create a new function. They want you to change the syntax of the original greet function. So keep the code in the greet function the same but change the
function
keyword to the syntax you have in the greeting method.Then make should to follow the tip of declaring arrow functions before calling them.