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 Greer
Front End Web Development Techdegree Graduate 56,430 Pointsnot sure what to do next on javascript basic Returning value
I've rewatched videos and can't seem to find the answer
function getYear () {
var year = new Date().getFullYear();
}
<!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
Cheo R
37,150 PointsYou're close, you just need to do two things:
// return value
function() {
var variable = functionCall();
return variable;
}
and the second part is to save it's output in another variable.
var functionCallResult = functionCall();
matth89
17,826 PointsHey Ronald,
I'm assuming you're on step 2 of this challenge. You're quite close! In step two, after adding the provided line of code inside the getYear function, it wants you to return the year variable on the next line. If you are unsure of how to do this, maybe give the "Getting Information From a Function" video one more watch.
Side note: watch your spacing and indentation. There should be no space between your function name and the following parentheses. Also, the first line inside your function should be indented by two spaces.
Let me know if you have any more questions!
Ronald Greer
Front End Web Development Techdegree Graduate 56,430 PointsThank you so much Matt, you and Cheo really helped!
Ronald Greer
Front End Web Development Techdegree Graduate 56,430 PointsRonald Greer
Front End Web Development Techdegree Graduate 56,430 PointsThank you Cheo, you and Matt really helped