title: array length with key-value, js
body: <p>I wrote this piece of code, that should parse the given paramUnparsed (which should be an array in the form: <em>[key1=val1, key2=val2, .., keyn=valn]</em>).  </p>
  
  <pre><code>function parseParams(paramUnparsed){
  var params = [];
  for ( var j = 0; j &lt; paramUnparsed.length; j++) {
      if (paramUnparsed[j].split('=').length &lt; 2) {
          // error ! bad input structure, ignoring params -
  
          params = undefined;
          break; // we don't have to return error, depending
                  // on the function called and given params.
  
      }
      //else {
          var key = paramUnparsed[j].split('=')[0];
          var value = paramUnparsed[j].split('=')[1];
          params[key] = value;
      //}
  }
  
  console.log("In parseParams, params are: "+ concatObject(params));//DEBUG 1
  console.log("In parseParams, params length is: "+ params.length);//DEBUG 2
  return params;  
  }
  </code></pre>
  
  <p>How can I do this, and still determine the length of the array that I'm creating? I always get '0' on the 'DEBUG 2' printout...</p>