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

Stephen Funk
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"?

function random_age(age) {
  Math.floor(Math.random() * age);
<!DOCTYPE html>
    <meta charset="utf-8">
    <title>Futuristic MASH</title>
    <link href="normalize.css" rel="stylesheet">
    <link href="style.css" rel="stylesheet">
    <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[]">
      <input type="submit" value="Tell my fortune">

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


2 Answers

Steven Parker
Steven Parker
185,871 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
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.