 # Can anyone explain this? please

function expression(number, operation){

``````if(!operation)

return number;

return operation(number);
``````

}

It’s hard to say without the full code, but it looks like you are working with two arguments, a function `operation` and a number `number`. If you don’t have an `operation` you return the `number` otherwise you compute and return `operation(number)`.

!operation => that mean is if i don’t have a operation ?
and why i have a tow return? there is another way to type this code?

Right, `!operation` is a test that checks if `operation` is falsey. In this case falsey means you don’t have an `operation`.

There are two return statements because there are two different results you could be returning.

1 Like

Thank you very much.
i will show u full code. just i wanna know how that work! and thanks wise, with all my love function expression(number, operation){

``````if(!operation)

return number;

return operation(number);
``````

}

function five(operation) { return expression(5, operation); }

function seven(operation) { return expression(7, operation); }

function times(x) {

``````return function(y) {

return y * x;

}
``````

}

1 Like

gays, Hi
how can i tell JavaScript how the multiply work? like i wanna callback the multiply functions by one word, like that
five( multiply(7)).

and thanks for help!

In JavaScript and many other languages, it have a built in feature.

``````//multiplication
5 * 7
//division
5 / 7
5 + 7
//subtraction
5 - 7
``````

So if you want to put it in a function

``````function multiply(a, b) {
return a * b;
}

multiply(5, 7);
``````
1 Like

if you want something like `five(multiply(7))` to work you need to define a `five` function that accepts the other function as argument.
Can be done, but it is a bit complex.