title: Javascript Array Concat not working. Why?
body: <p>So I've created this jqueryui widget. Its creates a div that I can stream errors into. The widget code looks like this:</p>
  
  <pre><code>$.widget('ui.miniErrorLog', {
     logStart: "&lt;ul&gt;",   // these next 4 elements are actually a bunch more complicated.
     logEnd:   "&lt;/ul&gt;",
     errStart: "&lt;li&gt;",
     errEnd:   "&lt;/li&gt;",
     content:  "",
     refs:     [],
  
     _create: function() { $(this.element).addClass( "ui-state-error" ).hide(); },
  
     clear: function() { 
        this.content = ""; 
        for ( var i in this.refs )
           $( this.refs[i] ).removeClass( "ui-state-error" );
        this.refs = [];
        $(this.element).empty().hide(); 
     }, 
  
     addError: function( msg, ref ) {
        this.content += this.errStart + msg + this.errEnd; 
        if ( ref ) {
           if ( ref instanceof Array )
              this.refs.concat( ref );
           else
              this.refs.push( ref );
           for ( var i in this.refs )
              $( this.refs[i] ).addClass( "ui-state-error" );
        }
        $(this.element).html( this.logStart + this.content + this.logEnd ).show();
     }, 
  
     hasError: function()
     {
        if ( this.refs.length )
           return true;
        return false;
     },
  });
  </code></pre>
  
  <p>I can add error messages into it, and references to page elements that is will put into an error state. I use it to validate dialogs. In the "addError" method I can pass in a single id, or an array of ids, like this:</p>
  
  <pre><code>$( "#registerDialogError" ).miniErrorLog( 
     'addError', 
     "Your passwords don't match.", 
     [ "#registerDialogPassword1", "#registerDialogPassword2" ] );
  </code></pre>
  
  <p>But when I pass in an array of id's it doesn't work. The problem is in the following lines (i think):</p>
  
  <pre><code>if ( ref instanceof Array )
     this.refs.concat( ref );
  else
     this.refs.push( ref );
  </code></pre>
  
  <p>Why doesn't that concat work. this.refs and ref are both arrays. So why doesn't the concat work?</p>
  
  <p>Bonus: am I doing anything else dumb in this widget? It's my first one.</p>