This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function compose(func, ...funcs) { | |
| return function(...args) { | |
| return funcs.length > 0 | |
| ? compose(...funcs)(func(...args)) | |
| : func(...args) | |
| } | |
| } | |
| // Or, in a more compact version: | |
| const compose = (func, ...funcs) => (...args) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mat = [ | |
| [1, 2, 3, 4], | |
| [5, 6, 7, 8], | |
| [9, 10, 11, 12], | |
| [13, 14, 15, 16] | |
| ]; | |
| var DIRECTIONS = { | |
| FORWARD: 1, | |
| BACKWARD: -1 |
NewerOlder