Last active
December 18, 2015 04:59
-
-
Save robertklep/5729837 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var f = function(value) { | |
console.log('value:', value); | |
}; | |
var x = f.bind(f, 'foo'); // pass 'foo' as a pre-specified argument to f(), and return it as a new function x() | |
x(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
var test = function(locals, callback) { | |
console.log('locals:', locals); | |
callback(null); | |
}; | |
function run() { | |
var locals = [ 'a', 'b', 'c' ]; | |
async.series([ | |
test.bind(test /* or null, or ... */, locals) | |
], function(err) { | |
console.log('error?', err); // should say 'error? null' | |
}); | |
} | |
run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment