fetch('www.example.com/data') .then((res) => { if (!res.ok) { throw new Error('Error' + res.status) } return res.json() }).then((data) => { console.log('Data', data) }).catch((error) => { console.error('Error', error) })
fetch('www.example.com/data') .then((res) => { if (!res.ok) { throw new Error('Error' + res.status) } return res.json() }).then((data) => { console.log('Data', data) }).catch((error) => { console.error('Error', error) })