// 1.Get the API.
// 2.Check if we resolved the promise.
// 3.Condition of "else" will return the status of our promise.
fetch("https://example/api")
.then(res => {
if(res.ok){
return res.json()
}else{
return Promise.reject(res.status)
}
})