Functions & If/Then Else-Different Error


I am doing the sleepCheck lesson and can not figure out what I am doing wrong. I've looked at the code over and over and it matches others' posts that work. What am I missing? All statements end with ; where appropriate and all curly brackets are in matching pairs. I'm perplexed.

Here is the error: ReferenceError: sleepcheck is not defined

Here is my code:

var sleepCheck = function(numHours) {
if (numHours >= 8) {
return "You're getting plenty of sleep! Maybe even too much!";
} else {
return "Get some more shut eye!";



your code is fine, try a different browser. This will give you a new connection, could be your browser was sending cached data


I had been using Firefox. Tried the same code in Chrome (which I had
never used for CodeAcademy) and I get the same error. Cleared the cache
on both browsers and still get the same error. Something strange is going on. I can't get past or get credit for that lesson.


But the code is perfect, i made sure of it. Uhm.. i will ask around


take a screenshot and post it here



I even tried cutting the code, pasting it into notepad, hit the "reset code" button, and then pasting the code that should work back into the javascript window. I still get the error. Clearing the cache does not fix it, different browsers does not fix it. It looks like there may be some server side profile issue here.


problem is last one
sleepCheck not sleepcheck


Nice catch :slight_smile: But in the earlier code bsalle posted:

sleepcheck was spelled correctly.