Click here to Skip to main content
14,271,322 members
Rate this:
Please Sign up or sign in to vote.
See more:
toencode: function ()
{
var xml = '';
var i = 1;
for (var p in this.pl)
{

xml += p + '=' + this.pl[p];
if(i < this.pl.length)
{
xml += '&';
}
i++;
}

return xml;
}


when my debugger come at this.pl.length at this point it shows that length is undefined.
but i have 3 parameter in pl.
and if condition is not going to execute.
can anyone help out me?
Posted
Updated 22-Nov-11 21:13pm
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Use the length property.

Example (taken from http://www.w3schools.com/jsref/jsref_length_array.asp[^])
<script type="text/javascript">

var fruits = ["Banana", "Orange", "Apple", "Mango"];
 document.write("Original length: " + fruits.length);
 document.write("<br />");
 fruits.length=5;
 document.write("New length: " + fruits.length);
</script>
   
Comments
prince_rumeel 23-Nov-11 3:14am
   
toencode: function ()
{
var xml = '';
var i = 1;
for (var p in this.pl)
{

xml += p + '=' + this.pl[p];
if(i < this.pl.length)
{
xml += '&';
}
i++;
}

return xml;
}

when my debugger come at this.pl.length at this point it shows that length is undefined.
but i have 3 parameter in pl.
and if condition is not going to execute.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100