Hi,
I'm not sure if there's a technical benefit of this syntax, but I
think I prefer reading it... Any JS wizards out there like to comment?
Cheers
Simon
On 3 Sep 2009, at 09:53, Nils Breunese wrote:
I even learned that using for (... in ...) is not safe for use with
arrays. I tend to use Array.forEach() [0] like this:
----
function(doc) {
if (doc.users) {
doc.users.forEach(function(user) {
emit(user, doc);
});
}
}
----
I'm not very proficient in JavaScript, so maybe there is no real in
advantage in the realm of CouchDB.
Nils Breunese.
[0]
https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference:Objects:Array:forEach