// nest them var a = 0 var b = 0 fs.readFile('filename.txt', function(err,data){ a = data fs.readFile('file2.txt', function(err,data){ b = data console.log(a,b) // both values }) }) // use a library called async // npm install --save async var async = require('async') var fns = [] // array of functions var a = 0 var b = 0 // push a function on to the array fns.push(function(done){ fs.readFile('filename.txt', function(err,data){ a = data return done() // a special async function that signals to move on }) }) // push another function on to the array fns.push(function(done){ fs.readFile('file2.txt', function(err,data){ b = data return done() // a special async function that signals to move on }) }) // push the last function on to the array fns.push(function(done){ console.log(a,b) // both values are populated return done() }) async.series(fns) // this is where all the 3 functions you just pushed on to the array are run in order