user6008337 - 6 months ago 12

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);
```