Js.InterviewTasks.CalcNumbersInFunctions

//one(plus(two()))

//two(plus(one()))

const one = (x) => {
  return x ? 1+ x : 1;
}

const plus = (x) => {
    return x;
}

const two = (x) => {
  return x ? 2 + x : 2;
}


console.log(one(plus(two())));
console.log(two(plus(one())));

three(times(five())); // return 15



// -- DECISION

function three(x){
    return 3*x
}

function times(x){
    return x;
}

function five(){
    return 5;
}

let f = three(times(five())); // return 15
console.log(f);
eight(minus(two()))
const eight = (x) => {
  return 8 + x;
}

const minus = (x) => {
  return -x;
}

const two = () => {
  return 2;
}

const f = eight(minus(two())); // return 6
console.log(f);

one(plus(six(dividedBy(three())))); // 3

let one = function (x){
  return 1 + x;
}

let plus = function (x){
  return x
}

let six = function (x) {
  return 6 * x;
}

let dividedBy = function(x) {
  return 1/x;
}

let three = function() {
  return 3;
}

const f = one(plus(six(dividedBy(three()))));
console.log(f);
This entry was posted in Без рубрики. Bookmark the permalink.