var response = fetch('http://localhost:8082/tracks/read/'+trackid)
.then(
function(response) {
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
console.log('Fetch Success')
response.json().then(function(dataData) {
console.log(dataData.album.name);
return dataData.album.name;
});
}
)
.catch(function(err) {
console.log('Fetch Error :-S', err);
});
New to javascript, having some real trouble working out promises and such.
All I want to do is be able to access the dataData.album.name
outside of the function or method or variable or whatever this stuff is.
Whenever I set dataData.album.name
to a variable it immediately becomes undefined once it is out of the scope of the promise
Simply can't work it out, would love any assistance