Decyphering some cryptic legacy JavaScript

javascript

Solution

It appears to be a loop through each element on a stack, which may contain functions. If the loop encounters a function, it executes it with no arguments.

Problem

Quick question (I think). Given this piece of code: ``` SomeObject._gaCallbackStack.each( function(callback) { if ($type(callback) == 'function') callback(); }); ``` What exactly is going on here? Is the code calling a function named "callback()" for each function stored in the Callback Stack? Or is it calling each function in the Callback Stack by appending "()" to the end of the variable name? Thanks for the help!

Original source