✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Що виведе наступний код, якщо сервер повернув статус 404?
fetch('/api/data')
.then(res => {
if (!res.ok) throw new Error('Error ' + res.status);
return res.json();
})
.then(data => console.log(data))
.catch(err => console.log('caught'));