Response.prototype.ok

The boolean indicating whether the response was successful (status in the range 200-299) or not.

Syntax

ok

Examples

fetch('https://example.com').then(r => print(r.ok))
true

fetch('https://example.com/404').then(r => print(r.ok))
false