I'm trying pass "t_id" value to the next function (func_B), when I execute the below code i'm getting "Undefined" message in the response. Can you help me to correct the below script ?
function func_A(){
request(options, (error, response, body) => {
const data = JSON.parse(response.body)
t_id= String(data.result[0].test_id.value)
console.log('Response id ' + t_id)
return t_id
});
}
function func_B(id){
var names = func_A();
console.log('function2 response ' + names);
}
func_B(id)
Response:
Response id B12T5343J989L
function2 response undefined