Skip to content

Instantly share code, notes, and snippets.

@guyellis
Created April 25, 2014 21:38
Show Gist options
  • Save guyellis/11304222 to your computer and use it in GitHub Desktop.
Save guyellis/11304222 to your computer and use it in GitHub Desktop.
// Demonstrates to anyone who has any doubts that
// lodash remove() will not procede (i.e. execute
// synchronously) until it has a result.
var _ = require('lodash');
var x = [1,2,3,4,5,6,7,8,9];
console.log('a1: ' + a);
var a = _.remove(x, function(item){
var r = delay();
return item == 5;
});
console.log('a2: ' + a);
function delay() {
var y = 0;
for(var i=0; i<100000000; i++) {
y += i;
}
return y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment