10

Where Should Your Code Live?

In this Chapter

  • Learn about the various places your code can live

  • Understand the pros and cons of the various approaches

Let’s take a break from our regularly scheduled…programming (ha!). So far, all of the code we have written has been contained fully inside an HTML document:

<!DOCTYPE html>
<html>
 
<head>
  <meta charset="utf-8">
  <title>An Interesting Title Goes Here</title>
 
  <style>
    body {
      background-color: #EEE;
    }
 
    h1 {
      font-family: sans-serif;
      font-size: 36px;
    }
 
    p {
      font-family: sans-serif;
    }
  </style>
</head>
 
<body>
  <h1>Are you ready for this?</h1>
  <p>Are you ready for seeing (or already having seen!)
     the most amazing dialog ever?</p>
 
  <script>
    alert("hello, world!" ...

Get Javascript Absolute Beginner's Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.