I want to return the data to a variable. I have resolved the promise and making it print to console. I want that the data should be access outside and can be used by a variable. I want whatever values are there in console.log(x) , should come outside the loop in a variable ( say variable name z)
var libobj =await service.getdata(); //----------> returning from service file and libobj is returning promise (fullfilled)
// var z; -----Data needed here or below the map loop
libobj.map( (res: any) =>
(res.then((x : any )=>console.log(x)) )); //--------> console .log(x) printing all the data needed