Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<meta charset="utf-8">
<button onclick="doClick()">Click me</button>
<div id="log" style="font-family: monospace; white-space: pre;"></div>
<script>
  "use strict";
  const log = document.querySelector("#log");
  function doClick() {
    fetch("/").then(res => {
      // This code is buggy and will cause an unhandled promise rejection.
      log.textContent += res.josn();
    });
  }
  window.addEventListener("unhandledrejection", e => {
    log.textContent += "Pretend I sent this to a server-side error-reporting solution:\n\n" + e.reason.stack;
  });
</script>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers