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 trialRonald Hughes
7,565 PointsWhen I check my work on Task 3 it says Task 1 is no longer passing, but when I retry Task 1 it says it is correct.
Unsure of where I'm going wrong.
function getYear() {
var year = new Date().getFullYear();
return year;
}
var yearToday = getyear();
<!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>
1 Answer
Steven Parker
231,269 PointsYou were really close!
Your function name is "getYear" (with a capital "Y"), but when you called it, you used the name "getyear" (with a lower-case "y").
Since "getyear" is not defined, it caused a syntax error, which invalidates the entire script. And as the challenge re-checks the tasks in order, it interpreted it as a task 1 failure.
Ronald Hughes
7,565 PointsAh wow! I was so focused on my character usage that my eyes must have skipped over that. Thank you!
Ronald Hughes
7,565 PointsRonald Hughes
7,565 PointsTask 1 is create function getYear