JavaScript JavaScript Basics (Retired) 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

function getYear
var year = new Date()
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

3 Answers

Jason Anders
Jason Anders
Treehouse Moderator 145,084 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
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,633 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.