# Execute anonymous functions directly?

**URL:** <https://forum.kirupa.com/t/execute-anonymous-functions-directly/226955>\
**Category:** flash\
**Created:** [May 25, 2007, 10:22am UTC](https://forum.kirupa.com/t/execute-anonymous-functions-directly/226955 "2007-05-25T10:22:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![over666kill](https://avatars.discourse-cdn.com/v4/letter/o/f6c823/32.png) [@over666kill](https://forum.kirupa.com/u/over666kill)\
**Post date:** [May 25, 2007, 10:22am UTC](https://forum.kirupa.com/t/execute-anonymous-functions-directly/226955/1 "2007-05-25T10:22:45Z")

</div>

Why can’t I execute an anonymous function directly, like:

var a=function() {return “hello”;} ();  
trace(a);

The trace statement should output ‘hello’, but it just outputs ‘undefined’. This is supposed to work in JavaScript (according to Mr Douglas Crockford). I thought Actionscript was compatible with JavaScript in this regard…
