when i run code get this error:
cant find variable: flagData
how can return(pass) data from promises implement(i use promises in another function)
resultOTP = OTP.fetchData(uniqueId, mobileNumber)
    .then((data) => {
      data.map((data)=>{
        if(data.message == "-1"){
          var flagData = 0
        }
        else {
          var flagData = 1
        }
      })
    })
    alert(flagData)
 
     
    