btw http://www.devthought.com/2011/12/22/a-string-is-not-an-error/
On Friday, March 9, 2012 3:30:49 AM UTC-7, Angelo Chen wrote: > > Hi, > > Struggling to change coding practice, following has two samples, which > one is correct? or any other approaches available? > > exports.get_user = function (id, func) { > var found = false > for (var i = 0; i < users.length; i ++) { > if (users[i].id === id) { > found = true > func(null, users[i]) > break; > } > } > if (!found) > func("NOT_FOUND", null) > } > > > exports.get_user = function (id, func) { > for (var i = 0; i < users.length; i ++) { > if (users[i].id === id) { > func(null, users[i]) > break; > } > if (i == users.length) > func("NOT_FOUND", null) > } > } -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en