Question on "ANSWER: Asynchronous Processing of Array"

35 views
Skip to first unread message

kenmatin

unread,
Aug 21, 2013, 3:27:34 PM8/21/13
to ui...@googlegroups.com
I am not sure if I understand the answer part:

why the author, put the next as a callback, and I think the question does not ask like that :(

I think it should be something like this:
function processItems(items, processItem) {
    "use strict";
    var i;
    function y() {
        return true;
    }
    for (i = 0; i < items.length; i = i + 1) {
        processItem(items, y);
    }
}
// x ---> processItem
function x(item, successCB) {
    "use strict";
    if (successCB && typeof successCB === "function") {
        successCB.call();
    }
}

Kind Regard
kenmatin
Reply all
Reply to author
Forward
0 new messages