Javascript result of anonymous function in or

javascript

Solution

Invoke the function using `()`:

myarray[myelement] = myarray[myelement] || function() { return "result" }();

JS Fiddle: http://jsfiddle.net/Lbgk7/

Problem

is it possible to get the result of an anonymous function like so: ``` myarray[myelement] = myarray[myelement] || function() { return "result" }; ``` Basically i want to assign the value of the function if the array element does not exist

Original source