I have the following script that dumps a given array’s contents
function dump(obj) {
obj = obj || {};
var result = [];
$.each(obj, function (key, value) { result.push('"' + key + '":"' + value + '"'); });
return '{' + result.join(',') + '}';
}
… but I don’t understand the “array” functions of this. Can you tell me what I need to learn to comprehend what is going within the .each statement?
Update
e.values below is an example of what obj looks like.

This is using jQuery for the
eachhttp://api.jquery.com/jQuery.each/ to do the iterating. Here is what happens in yourdumpfunction:Edit
If you need to get the key(s) of an arbitrary
Objectyou can use:Here’s a working example.
You could also have a look at Underscore.js’s _.keys().