Interested in programming since an early age; decades as a hobbiest; years as a teacher and tutor. These days working a lot with JavaScript and Python, but I try to explore everything.
() => { ... } is an anonymous function, which is then assigned to const foo.
The other code:
foo(function () {} );
also uses an anonymous function (using different syntax). This code would mean call the function "foo" and pass an anonymous (and empty) function.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The code has one too many "foo"s, it should be:
const foo = () => {
assignedVariable = 14
}
() => { ... } is an anonymous function, which is then assigned to const foo.
The other code:
foo(function () {} );
also uses an anonymous function (using different syntax). This code would mean call the function "foo" and pass an anonymous (and empty) function.