<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title> JavaScript WordCounter</title>

  <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" href="css/skeleton.css">

</head>
<body>
  <div class="container">
    <div class="row">
      <div class="ten columns">
        <h3> JavaScript WordCounter </h3>
        <p>
          Enter some text in the field below to try it out:
        </p>
        <textarea class="u-full-width" id="count-area" onchange="countWords()"></textarea>
        <p id="results"></p>
      </div>
    </div>
  </div>
  <script type="text/javascript" src="js/counter.js"></script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title> JavaScript WordCounter</title>

  <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" href="css/skeleton.css">

</head>
<body>
  <div class="container">
    <div class="row">
      <div class="ten columns">
        <h3> JavaScript WordCounter </h3>
        <p>
          Enter some text in the field below to try it out:
        </p>
        <textarea class="u-full-width" id="count-area" onchange="countWords()"></textarea>
        <p id="results"></p>
      </div>
    </div>
  </div>
  <script type="text/javascript">
    (function() {
      var text = document.getElementById('count-area').value;
      if (text != "") {
        var count = text.match(/\S+/g).length;
        document.getElementById('results').innerHTML = "I spot " + count + " words";
      }
    })();
  </script>
  <script type="text/javascript" src="js/counter.js"></script>
</body>
</html>

Add function to check initial value of text
Add function to check initial value of text

The function runs on the initial page load and outputs the initial
number of words in the textarea before any changes are made to it/
