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

Stephen Funk
PRO
Stephen Funk
Pro Student 2,650 Points

I'm stuck on this code objective. Call the function by giving an age in the parameter. I keep getting errors.

What is the answer to "The structure of functions - Part 3 of 3"?

script.js
function random_age(age) {
  Math.floor(Math.random() * age);
}
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

Steven Parker
Steven Parker
171,342 Points

The challenge wants you to supply an argument.

When the challenge refers to "the space for a parameter", they mean between the parentheses that follow the function name when you call the function. They want you to put a number (that might be an age) there.

Stephen Funk
PRO
Stephen Funk
Pro Student 2,650 Points

Thanks - I had put a number and it didn't accept it before I left this comment. I don't know why it didn't accept it, and then accepted it after leaving the comment.