It might be clearer to do this:
function sample(callback) {
// Do something
cond ? callback() : // Do something else
}
Here's a function that sums values of an array then multiples total by x.
void ensures the final multiply exits the loop
for (var i=arr.length, r=0; i-- || void (r = r*x); r += arr[i]);
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]