<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>JavaScript</title>
  <script>
   let stock = 5;
   function sold(amount) {
      if (amount > stock) {
        throw new Error("Out of stock");
      } else {
        stock = stock - amount;
      }
   }
   try {
     sold(8);
   } catch(error) {
     console.log(error.message);
   }
</script>
</head>
<body>
  <section>
    <h1>Website</h1>
  </section>
</body>
</html>