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 trialsamantha caplan
2,932 PointsMy code is functioning perfectly when tested in the browser, so no idea why my answer is returned as incorrect...
I can't figure out why this keeps being deemed an incorrect answer to Challenge Task 1 - it's works perfectly fine when checked, and seems to fulfill the challenge prompt. What am I missing?
(Ps the alert was only to check that the function was working, code check fails with or without the alert)
function returnValue(qty) {
var total = qty * 10;
alert(total);
return total;
}
returnValue(2);
<!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
Gareth Borcherds
9,372 PointsSometimes the tests are a bit literal. It says to return the value and don't do anything to it. So to pass challenge 1 just use this.
function returnValue(qty) {
return qty;
}
samantha caplan
2,932 PointsThanks Dave McFarland
I know it was supposed to simplify the question, apparently I can't make things not make sense... :)
Dave McFarland
Treehouse TeacherHa! That's a good habit to have.
samantha caplan
2,932 Pointssamantha caplan
2,932 Pointsthanks....but UGH to that. I was convinced I was wrong. I think i've spend almost as much time figuring out how to get as close to literally answering the questions as possible so they pass, as I have actually answering the questions so that they work...
Dave McFarland
Treehouse TeacherDave McFarland
Treehouse TeacherHi samantha caplan
What Gareth Borcherds said :)