JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<body>
<script>
var scan = function(){
var address = prompt("IP:port to scan?", "127.0.0.1:8000")
var t0 = new Date()
document.write(`Scanning ${address} at ${t0}...`)
img = document.createElement("img")
img.onerror = function(){
delta = new Date() - t0
console.log(address + " is " + ((delta<400)?"open!":"closed!"))
}
img.src = `http://${address}/test.gif`
}
scan()
</script>
</body>
</html>