Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
js one variable can not pass the other variable data

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!