Directly Calling Anonymous Function In Javascript
In Javascript we can define a anonymous function and directly call it like this:
((x) => x*2)(24)
In above we defined an anonymous function, which accept a parameter x
and double its value then return. And we directly call it by passing argument 24
into it. And here is the output of the function:
We can see the function is directly called and the result 48
is the result.