user6008337 - 8 months ago 27

Javascript Question

I am learning javascript, i was wondering if it was possible to have something like this use of lambda function

`function operation (function f, num1, num2){`

f.call(num1, num2);

}

operation((a,b)=>{return a+b}, 2,3);

I have

Answer

Try this:

```
function operation (f, num1, num2){
f(num1, num2);
}
operation((a,b)=>{return a+b}, 2,3);
```

JavaScript is **untyped** language. If you want to use `call`

, try this:

```
function operation (f, num1, num2){
f.call(this, num1, num2);
}
operation((a,b)=>{return a+b}, 2,3);
```