Importing global array/object


menu = function(){
   return [
        {url: "/path1", name: "name1"},
        {url: "/path2", name: "name2"},

So menu is a global client side variable.


    menuItems: function (){
        console.log(menu());  // This gets error : TypeError: menu is not a function
        return menu();   //This works.

Why does the return value of the global function work ok when returned in the function, but not when used in the function. Is it something to do with load order - if so, how can I insure the app/client/lib/definitions.js file is loaded before my template. According to Meteor Guide, the definitions.js file should be loaded before the footer.js file.