Here is my code:
async function rScript() {
var dbHost1 = '';
var dbHost2;
var DDD = await lineReader.eachLine(file, function(line) {
if (line.includes('DB_HOST')) {
dbHost2 = line.substr(18, 11);
console.log('dbHost2', dbHost2);
dbHost1 = dbHost2;
}
});
console.log('DDD', DDD)
console.log('dbHost1', dbHost1);
}
result:
DDD { getReader: [Function: getReader] }
dbHost1
dbHost2 'localhost'
Here i set dbHost1 value as dbHost2 data but its not getting the data from dbHost2 ? whats the problem in my code?