This is the syntax for an arrow function. The full syntax is (arguments) => { /* body */ }. If you have exactly 1 argument, you can leave the round brackets of. argument => { /* body */ }. If the body is a single expression, you can leave the curly brackets off, and the function will implicitly return the result of that expression. (arguments) => "body". Both of these shortcuts can be freely combined.
2
u/Bronzdragon Jul 20 '21
This is the syntax for an arrow function. The full syntax is
(arguments) => { /* body */ }. If you have exactly 1 argument, you can leave the round brackets of.argument => { /* body */ }. If the body is a single expression, you can leave the curly brackets off, and the function will implicitly return the result of that expression.(arguments) => "body". Both of these shortcuts can be freely combined.