1 min readDec 24, 2017
Whether or not the return
is required depends upon how the arrow function is declared. The right-hand side of an arrow function can be an expression or a brace-enclosed block of statements. When an expression is used, it’s evaluated and implicitly returned — no return
is required:
const source = Observable.defer(() => Observable.of(42));
When a block is used, an explicit return
is required:
const source = Observable.defer(() => {
return Observable.of(42);
});
For more information on arrow functions, see the MDN documentation.