In javascript there is no function for printing variables like you have PHP, I use print_r and var_dump alot in PHP for dumping variables
so I wanted to create a simular function in javascript.
If you want to walk through unknown child objects in javascript you can use a operator called ‘in’ like this:
//Create a object
element = {child1: 'First child', child2: 'Second child'};
string = '';
//Loop through all the child objects in element
for(property in element)
{
//Add the name and value of the child object
string += property + ': '+ element[property] + ''+ '\n';
}
//Ouput the result
alert(string);