1

I am working on project using Nedb as database. What i need is to call variable inside database in other function. What i did is to use db.find to get variable from database like this:

function findvariable(){
var prob=0;
db.find({}, function(err, newDoc) {
prob= newDoc[0].probability;
});
}

so how i can call prob variable outide db.find, for example inside test function like this:

function test{
var a =prob;
console.log(a);// a will get the value of prob
}

Can someone help me?

BELLAL
  • 19
  • 4

0 Answers0