Rest API - REST API Fundamentals
This code snippet tries to parse JSON from an API response but throws an error:
What is the best fix?
fetch('https://api.example.com/data')
.then(response => response.text())
.then(data => JSON.parse(data))
.then(parsed => console.log(parsed))
.catch(err => console.error(err))What is the best fix?
