I have a code something like this:
function getData(query){
fetch('some-url').then((res)=>res.json())
.then((res)=>{
return 'string'+res.data
})
The above function is
var data = getData('text');
I want the getData function to return modified string to store it in the variable data. How do I achieve this?