JavaScript Treehouse Club - MASH MASH - JavaScript The Structure of Functions - Part 2 of 3

farah hussain
farah hussain
9,218 Points

closing characters

Add the closing character (hint: it's kind of like a period in a sentence) at the end of the body of the function.

script.js
function random_age(age) {
  Math.floor(Math.random() * age)
}
index.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Futuristic MASH</title>
    <link href="normalize.css" rel="stylesheet">
    <link href="style.css" rel="stylesheet">
  </head>
  <body>
    <h1 class="logo"><img src="img/mash-logo.svg" /></h1>
    <p class="instructions">Fill in the blanks and your future will be foretold.</p>
    <form action="" method="post" id="mash">
      <div class="choice-bucket">
        <h4 class="highlight">What's your future pet?</h4>
        <input name="pet[]">
        <input name="pet[]">
        <input name="pet[]">
        <input name="pet[]">
      </div>
      <input type="submit" value="Tell my fortune">
    </form>

    <script src="script.js"></script>

  </body>
</html>

2 Answers

Cindy Lea
PRO
Cindy Lea
Pro Student 6,482 Points

In the challenge I took they dont have all this code you listed. Make sure you start with the original code they give you & put a semicolon at the end of the statement in the function & it worked for me.

Cindy Lea
Cindy Lea
Pro Student 6,482 Points

Its in the script.js file, not the index.html file. The script.js file should look like this:

function random_age(age) {
  Math.floor(Math.random() * age);
}
Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 25,635 Points

Hey Farah,

I'll guide you with this informative article at the Mozilla Developer Network.

Hope it helps!