Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Eliakim Hilkiah](https://secure.gravatar.com/avatar/29ea5ef9df80accf23f9b42e01f00db2?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Eliakim Hilkiah
Courses Plus Student 4,478 Pointshow do i call the function Call the function by giving an age in the space for a parameter.
Call the function by giving an age in the space for a parameter. 1 function random_age(70) { 2 Math.floor(Math.random(70) * age) 3 var random_age(70) 4 } 5 random_age(70);
function random_age(70) {
Math.floor(Math.random(70) * age)
var random_age(70)
}
random_age(70);
<!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>
3 Answers
![Rhys Kearns](https://secure.gravatar.com/avatar/f0bd400de6cc29043c92b480196b1035?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Rhys Kearns
4,976 Pointsfunction random_age(age) {
// Creating the function random_age and passing the age variable as a parameter
Math.floor(Math.random() * age)
// Rounding down a random number then timesing by 70 which was passed into the function when i called random_age
}
random_age(70);
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsIt looks like you have called the function correctly on the bottom line. But you also modified the function itself which created the issue. Remove that modification, or start over and leave the provided function as-is.
Steven Parker
230,688 PointsSteven Parker
230,688 PointsThe "age" variable declared on the top line isn't being used in this code (and is not needed). The only thing needed for this challenge is to plug in a value for the parameter.
Rhys Kearns
4,976 PointsRhys Kearns
4,976 PointsYou are correct Steven thanks for pointing that out! I tunnel visioned and placed it there trying to translate his code over!