0

I want to copy response to p1, and then log the value of p1.

But p1 is showing undefined or null.

The data type is object which is not copying to p1 .

display = async () => {
  var p1={};
  client.get('results', (err, results) => {
    console.log('res1',results);
    p1 = JSON.parse(JSON.stringify(results));
  });
  console.log('p1',p1);
}
Andy
  • 61,948
  • 13
  • 68
  • 95
Usman
  • 63
  • 2
  • 13

0 Answers0