Skip to content

Instantly share code, notes, and snippets.

@seanstrom
Created January 20, 2015 03:48
Show Gist options
  • Save seanstrom/4f8acad26e9d73f4a970 to your computer and use it in GitHub Desktop.
Save seanstrom/4f8acad26e9d73f4a970 to your computer and use it in GitHub Desktop.
Async JS/Node - Node Callbacks - Don't use return values from Callbacks example
var fs = require('fs')
, path = 'my_file.txt'
, file
file = fs.readFile(path, function(err, fileData) {
if(err) {
console.log(err)
} else {
console.log('success')
}
});
console.log(file) // wtf?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment