Skip to content

Commit 0291178

Browse files
committed
Optimizations in JavaScript examples
1 parent e3dfe8c commit 0291178

3 files changed

Lines changed: 2 additions & 2 deletions

File tree

JavaScript/3-arguments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
let compose = (f1, f2) => (...args) => f2(f1.apply(null, args));
3+
let compose = (f1, f2) => (...args) => f2(f1(...args));
44

55
let s = 'MARCUS AURELIUS';
66
console.log(s);

JavaScript/4-multiple.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
let compose = (...funcs) => (...args) => (
4-
funcs.reduce((args, fn) => [fn.apply(null, args)], args)
4+
funcs.reduce((args, fn) => [fn(...args)], args)
55
);
66

77
let s = ' MARCUS AURELIUS ';

0 commit comments

Comments
 (0)