JavaScript JavaScript Basics Creating Reusable Code with Functions Returning a Value from a Function

something weird is happening

this is not my code. everytime I restart this, I get different screens. it was originally blank. It keeps changing

script.js
function getYear
var year = new Date()
.getFullYear(){
}
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>

3 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 144,810 Points

Hi Kim,

It sounds like some sort of caching issue. When I launch the challenge, I do just get the blank code box to start the challenge.

I suggest you clear you cache and then re-launch the challenge. If that fails, try logging out of Treehouse, clearing your cache, quitting your browser and then relaunching everything fresh.

If all else fails, you'll need to contact the Treehouse Support Team for this. Just remember that today is a Holiday in the US, so the Support Staff may not get back to you until tomorrow.

Hope you get it sorted out. :) :dizzy:

thank you. i'm trying to get the last two questions done so i'll be finished. i've tried clearing my cookies and history. it seems to be happening with my laptop more than my new computer. the last two are sticking too .

Brendan Whiting
MOD
Brendan Whiting
Front End Web Development Treehouse Moderator 84,103 Points

Challenge Task 1 of 3 we just want to define the function:

function getYear() {

}

Then Challenge Task 2 or 3 they want us to add that line code inside the function, and return the year variable:

function getYear() {
  var year = new Date().getFullYear();
  return year;
}

Something went wrong where you're missing some parts of it.

I know that it's wrong Brendan. I didn't write it. it's coming up by itself in random ways.