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.

Gremyko Coleman
9,162 PointsHow would you do this same example of passing a function into another function using arrow functions instead?
I don't get it, Guil was using arrow functions earlier in this track, but for this example he uses the old style of declaring function, so, its confusing me. I don't know how to use this same example in the video using arrow functions instead.
function say(something){
console.log(something);
}
function exec(func, arg){
func(arg);
}
exec(say, "hi, there");

abcdefte
25,162 PointsLet me know if this helps
const say = something => {
console.log(something);
}
const exec = (func, arg) => {
func(arg);
}
exec(say, "hi, there");
1 Answer

DANIEL CALDERON V
8,407 PointsHello, there.
I know this is a old question, buy maybe you can still use this answer, or other students in the Community.
const exec = (func, arg) => func(arg); exec(something => console.log(something), 'Hi there')
That would work
Julian French
3,257 PointsJulian French
3,257 PointsHey, would you mind pasting in the example code here? Thanks!