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

JavaScript JavaScript Quickstart Functions Write a Function

I don't know where to go from here

I really don't know what I'm doing

script.js
function add10(1) {
 return num + 10
}
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

2 Answers

Sheila Anguiano
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Sheila Anguiano
Full Stack JavaScript Techdegree Graduate 35,239 Points

Hello, I think you're stuck on step number 3, but I'll write along the answers with a brief explanation

1. Create a Function named add10 I'll write the function along with the parenthesis , curly braces and ;

function add10(){};

2. Add the parameter num This means that inside te parenthesis we should write the parameter num, that will serve as a place holder for any subsequent number we want to pass to the function

function add10(num){ 
};

3.Inside the function return num + 10

function add10(num){ 
  return num+10;
};

The problem with your answer is that you're missing the num parameter in the function parenthesis, so when the program tries to execute RETURN, it kind of wonders NUM?? what NUM?, You have never mention NUM before. But if you look at my answer above. what we're saving is: HEY add10, I'm going to give you a number (be this 1,10000 or 1.12) and I want you to give me back this number + 10.

Also notices that you're missing the semicolons but this is common headache.

Hope this helps :)

Thank you Sheila!