JavaScript JavaScript Basics Creating Reusable Code with Functions Passing an Argument to a Function

Toni Hammond
Toni Hammond
Full Stack JavaScript Techdegree Student 8,158 Points

help! I need to modify the return value in Task #2 in Javascript, I have been stuck for hours what am i doing wrong guys

not sure what to do next :(

script.js
function returnValue(beans) { 
  return "beans"; 
}

var echo = returnValue('beans');
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

This worked for me

function returnValue(value){ return value; } var echo = returnValue(1);

Steven Parker
Steven Parker
176,584 Points

Task 2 says "Modify the returnValue function to accept one argument named value." But this function's argument is named "beans" instead.

Then, task 3 says "Finally, from the returnValue function return the value passed in." But this function is returning the constant string "beans" instead of the passed argument.

Fix those and you should pass the challenge. And it doesn't look like you need to create a new "echo" variable or call the function for this challenge.