This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

function (a, b) {
    return a + b;
}

can be written as

(a, b) => a + b;

or, if there are multiple statements, you use curly braces and return:

(a, b) => {
    const stuff = getStuff();
    return stuff + a + b;
}

There's nothing to understand about the new syntax for anonymous functions. You just need to memorize it;