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 Callback Functions in JavaScript Callbacks and the DOM Using Callbacks on Text Inputs

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

Use callbacks on text inputs

This is the first time I saw this -

event => {
// do something
}

If I am right , in arrow syntax , we do not mention the function name. Its something like this

function ( () => {
// Do something
});

Why he has written 'event' ?

1 Answer

Steven Parker
Steven Parker
229,967 Points

In that example, "event" is the parameter name.

If you had more than one parameter, or none at all, you'd have parentheses before the arrow like in the second example.

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

Thanks Steven . Got that completely :)
This course is really awesome. . When I first read "Higher Order Function" topic from the book "Eloquent JS" , I was sort of like "omg what's that?" . Really , I understood nothing.
But after understanding callback function , today I really feels so happy and excited for further journey. Thanks for helping me in my JAVASCRIPT journey Steven . :)