-1

Can somebody explain me how to solve this problem?

let konyvSzam=0;

   db.checkPeldanySzam(rentISBN,(konyv) => {
        konyvSzam=konyv.Peldanyszam;
    });

    console.log("Nr of books");
    console.log(konyvSzam);

The variable gets the value but after I check it doesn't work

MrNobody
  • 535
  • 8
  • 24

1 Answers1

1

Mostly our DB call works asynchrous in node js and JavaScript try to enclose db calls in promise or use async/await .

Vivek Anand
  • 1,264
  • 8
  • 15