Function help combining multiple vars I am very new to JS and am having a bit of a problem with making this happen.

function updateDisplay23() {

  var statElem = document.getElementById("stat_ht");

  if (statElem) {

    statElem.innerHTML = stats["ht"];

  }

}


I load all the functions from the index at the startup then call the function with:

updateDisplay23()


This works fine and loads the info to the index page as desired. The problem is I have 30 or so functions, and may add many more. This is a lot of calls, I would like to combine them all into one function call.  Someone hinted this may be possible.
Every function needs to be called to run. If you have 30 functions you need to call them all but if you want to call them only once you can do something like this:

            var callThemAll = function() {
                function1();
                function2();
                // call them all like this
            }


But there is also a 'lazy way' if I could call it like that. We create an object and these functions will become it's methods and we can iterate over them:

         var objWithFunctions = {
            myFirstFunction: function() {
                // code here
            }
            // rest of your functions
        }

        for(fn in objWithFunctions) {
            objWithFunctions[fn].call();
        }
        // all methods are being called


I wrote a full example here: http://jsbin.com/gaseti/1/

Edit:
After seeing your code(you posted it somewhere) the difference bettwen your function are just 2 strings.
You can make only one function with 2 parameters:

You can insert this into your code

            function updateDisplay(param1, param2) {

              var statElem = document.getElementById(param1);

              if (statElem) {

                statElem.innerHTML = stats[param2];

              }

            }


Call like this:

            updateDisplay("stat_ht", "ht");


Now, to call them all we could do this. Save all parameters into 2 separated arrays

var param1s = ["stat_ht","stat_ht","stat_ht"], param2s = ["ht","ht","ht"];

Call updateDisplay for each of this

            if(param1s.length == param2s.length) {
                for(var i = 0; i &lt;= params1.length; i++) {
                    updateDisplay(param1s[i], param2s[i]);
                }
            }