3 Replies Latest reply on Oct 18, 2006 2:01 AM by Newsgroup_User

    reference in function?

    Level 7
      Hi,

      I just was trying to do something simple I thought:

      _global.setIfEmpty = function(vari,val){
      if (vari==undefined) vari = val;
      }

      // variable background should set to the value if it is undefined
      setIfEmpty(background, "background.jpg");


      This does not seem to work. So I thought I might use a prototype to set
      the variable but can I set a prototype to undefined type?

      Or (/and) is there a way to use a variable in a function as reference?


      TIA