0

Unable to return value inside function in node.js . Below is my function which I am calling from another function to get desired value but I am getting undefined.

const getBBBMeetingInfo = (meetingID) => {

    let bbbHttp = bbb.http;
    let getMeetingInfo = api.monitoring.getMeetingInfo(meetingID);
    let val;
    bbbHttp(getMeetingInfo).then((result) => {
      let newRes = {};
      newRes = result;
      newRes.meetingID = meetingID;
      if(newRes.returncode == 'FAILED'){
        updateNotificationCallStatus(meetingID)
      }  
      val = newRes.returncode

    });

    return val
}

calling fuction like this

let bn =  getBBBMeetingInfo(ele.meetingId);
console.log(bn)//undefined

I am new to node.js. Please let me know how I can get it and use it as returned value.

Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
Bhinal Chauhan
  • 251
  • 3
  • 11

0 Answers0