Skip to content

Instantly share code, notes, and snippets.

@r01010010
Last active August 29, 2015 14:12
Show Gist options
  • Save r01010010/bf90002f209481493b3e to your computer and use it in GitHub Desktop.
Save r01010010/bf90002f209481493b3e to your computer and use it in GitHub Desktop.
Calling a defined in file var from a callback... undefined!
require('another_file.js');
var whatever = 8;
function foo(){
// calling a function from another file
foo_with_callback(function(returned_value){
console.log(whatever) // whatever is undefined <--- WHY ???
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment