To intercept a gazillion of close-votes, I can stress that it's not related to, let alone answered by, this thread.
I'm not sure how to return a value from a $.each(...) construction to the outer scope. Suppose that we have an array of JSON objects (or of arrays for that matter).
var output = "";
$.each(array, function (key1, value1) {
output += "[" + key1 + "] --> ";
$.each(value1, function (key2, value2) {
output += key2 + ":" + value2 + " ";
});
});
console.log(output);
Right now, as the example above illustrates, I'm relying on a predeclared output that I write to from each of the sub-levels of scope. It works. However, I can't stop feeling that it's not the best approach. I'd like to return something, instead of appending it to the semi-global output.