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 Basics (Retired) Creating Reusable Code with Functions Passing an Argument to a Function

I can't solve this Quiz. I have seen the video to the this many times. But I still can't firgure out what to write.

PLS Help

script.js
returnValue(hej){
  return hej;
}
returnValue(Hej med dig);
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

Travis Adams
Travis Adams
3,667 Points

You're close to solving this puzzle, but there's a few tiny things you left out.

1.) you forgot to use the keyword function:

function returnValue(hej){
  return hej;
}

2.) you didn't define a variable named echo to store the return value of your function call:

var echo = returnValue("Hej med dig");

*Also, you're passing in a string to the returnValue function, so you need to put your argument in quotes.

Hi Micheal,

First, you are not declaring the function keyword. You need to write "function" when declaring one. Plus, you are not closing your function with a semicolon.

Try it like this:

function returnValue(hej){
  return hej;
};