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 trialNatasha Harrington
12,769 PointsModify the returnValue function to accept one argument named value ?
Error stating that the function declaration doesn't have a parameter named value. What am I missing here?
const returnValue = (value) => {
return value;
}
<!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
Steven Parker
231,269 PointsEven though it took it for task 1, I suspect this course doesn't cover or properly recognize the ES2015 "arrow" syntax.
For this course, try sticking with the conventional function definition syntax.
Natasha Harrington
12,769 PointsYou're right. It accepted it in the first step of the challenge so I didn't even question it, thanks I was losing my mind.
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 PointsYouβre not missing anything really.
Technically a function declaration takes this format:
function nameOfFunction (param) {};
What youβve written is a function expression.
Your code works perfectly as is, but to complete this challenge youβll need to declare your function using the function keyword.
Natasha Harrington
12,769 PointsThank you.
Natasha Harrington
12,769 PointsNatasha Harrington
12,769 PointsAlso just as additional information I'm alternatively getting an error that says cannot read property '1' of null. On the same exact code. I even checked wrote the code in Atom checked that it worked (it does) and copied it back just to make sure i didn't have a syntax error in my original code. Not sure if I'm misunderstanding what they're asking for or?