Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Exercises/1-seq.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const seq = f => g => x => 0;
const seq = f => g =>
(typeof(g) === 'number' ? f(g) : seq(a => f(g(a))));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single-line function will be better


module.exports = { seq };
11 changes: 10 additions & 1 deletion Exercises/2-array.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
'use strict';

const array = () => null;
class A extends Array {
constructor(options = []) {
super(options);
return Object.assign(i => this[i], {
push: val => this.push(val), pop: () => this.pop()
});
}
}
// array is function
const array = new A();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to create function with name array, not instance of class. The purpose of this task is using closure for holding data instead of class fields.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run npm t before commit, one test fails.


module.exports = { array };
Loading