Javascript Exercise #12


Javascript Exercise #12

I don't know what is wrong with my code, in the Print Screen as you can see I have an alert message but I don't understand why... I tried with console log and without it to call the function and didn`t see the problem... because it is giving me the answer as you can see in the print screen...

Replace this line with your 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!");
   console.log(sleepCheck (10));
   console.log(sleepCheck (5));
   console.log(sleepCheck (8));


Should be:

if (numHours >= 8) {
        return ("You`re getting plenty of sleep! Maybe even too much!");

Instruction says to log "You`re getting plenty of sleep! Maybe even too much!"


I corrected what @denys.matsevych suggested but still giving me the same message alert...



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

// try without console.log


now the only difference is the result... I only have one print on the output


Your code was correct from the beginning. I think it's a glitch. Try to refresh your browser or reset code and paste my code.


did it as you suggested and it works, but the only difference that I saw between your code and mine is the spaces between parenthesis and curly brackets ... maybe as you said is a bug in the platform or I don't know maybe i did something wrong and I haven`t notice it...



I tried your code:


as I said... maybe I did something wrong...


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.