JSFiddle - React, Tailwind, and code Playground
by WoJWoJ
JavaScript
let offline = true
const main = () => {
return fetch('http://ip-api.com/json')
.then(() => {offline = false})
.catch((err) => {console.log(`the call failed: ${err}`)})
}
main().then(() => console.log(offline))