I have the code below. I would like to have an array (buttons) with one element pointing to a (closeFlag) function.
<script type="text/javascript"> var closeFlag = new function() { alert('Clicked'); } var buttons = { 'OK': closeFlag } </script>
However, when the page loads, a pop-up warning immediately appears. When the array is constructed, instead of using it as a pointer, JavaScript calls my function. What for? What mistake, misconception do I have?
source share