闭包(JS)迭代器

时间:2012-02-17 11:31:20

标签: javascript iterator google-closure

我将Python生成器转换为Google Closure迭代器时遇到的问题很少。

for n,nbrs in nodes_nbrs:
    for nbr,data in nbrs.items():
        yield (n, nbr, data)

我跟随并坚持下去

var nodeNbrs = map(this.adj.getKeyIterator(), function(n) {
    return [n, this.adj.get(n)]
});
var iter = new Iterator;
iter.next = function() {
    // what do I do?
};

1 个答案:

答案 0 :(得分:0)