Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Simple Answer Needed


Message #1 by "Chris Cote" <cotec@s...> on Thu, 25 Apr 2002 14:59:27
I'm having a lot of difficulty with what seems to be a simple problem.  
When I try to use the function, though, I end up with undefined values for 
everything.  Please help me!  I have so many different object arrays that, 
even though it wouldn't make it too long, it would make it easier to write.

This is what I have in my code:

function ObjectArray2String (ObjArray, sDelim) {
	var sString="";
	var prop, obj;
		
	for (obj in ObjArray) {
		for (prop in ObjArray[obj]) {
			sString = sString + ObjArray[obj].prop + sDelim;
		}
		sString += sDelim;
	}
	return sString.substr(0,sString.length-2);
}

And within another function, I call this one with:
   sData = ObjectArray2String(objData, "&");


What I end up with, if I display the sData variable in an alert, is:
  undefined&undefined&&undefined&undefined&&undefined&undefined


Please help,
Chris

  Return to Index