Skip to content

Commit

Permalink
Add tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
borseno authored Dec 29, 2024
1 parent 49d04b5 commit 08b8bd7
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# TwoTasks
Two easy tasks before you apply for an interview

1. Задача: не змінюючи логіки, змінити структуру коду, щоби вона відповідала принципу DRY:
ctx.prototype.__applyStyleState = function (styleState) {
var keys = Object.keys(styleState), i, key;
for (i=0; i<keys.length; i++) {
key = keys[i];
this[key] = styleState[key];
}
};
ctx.prototype.__setDefaultStyles = function () {
var keys = Object.keys(STYLES), i, key; // keys of object - object selection
for (i=0; i<keys.length; i++) {
key = keys[i];
this[key] = STYLES[key].canvas; // field selection
}
};
ctx.prototype.__getStyleState = function () {
var i, styleState = {}, keys = Object.keys(STYLES), key;
for (i=0; i<keys.length; i++) {
key = keys[i];
styleState[key] = this[key];
}
return styleState;
};

2. Друга задача:

const multiply = (a,b,c) => a*b*c;
const add = (a,b,c,d,e) => a+b+c+d+e;

const curry = (f) => { /* write your solution here */ }

curry(add)(1)(2)(3)(4)(5) == add(1,2,3,4,5) // should be true
curry(multiply)(1)(2)(3) == multiply(1,2,3) // should be true

Гарного дня! :)

0 comments on commit 08b8bd7

Please sign in to comment.