4 ms·
why not just function baz(modifier) { let foo = do_a(); let bar = modifier(foo); return do_b(bar); } Example 1: baz((foo) =>
by jpochtar 8y ago
why not just
function baz(modifier) {
let foo = do_a();
let bar = modifier(foo);
return do_b(bar);
}
Example 1: baz((foo) => foo);
Example 2: baz((foo) => do_z(foo));
Example 3: baz((foo) => foo + 10);
which lets you be more concise with
baz = (modifier) => do_b(modifier(do_a()))
- AriaMinaei 8y agoI explained more here: https://news.ycombinator.com/item?id=17801256 https://news.ycombinator.com/item?id=17801256