Lesson 12/13 having challenges


What could probably be wrong with this code:

var sleepCheck =function(numHours);

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


Where is your opening curly bracket? ... {
You also closed the code too early, remember the code that goes inside the { curly brackets } is the if/else statement
and to call sleepCheck, you do not need to console.log it, just a simple sleepCheck(10); will do
try to clean it up using the above suggestions
G Luck


the FUNCTION talk

var myFunc = function( param1, param2) {
       //Begin of  anonymous FUNCTION-BODY
       //VARIABLE -myFunc- has an -anonymous function- assigned
       //this -anonymous function- has 2 PARAMETERS param1 and param2
       //param1 and param2 PARAMETERS are used 
       //as -local- VARIABLES throughout the FUNCTION-BODY

      console.log( param1 + " and " + param2 ) ;

      //End of anonymous FUNCTION-BODY

If you want to call/execute the anonymous function
you will have to add a pair of parentheses to the variable myFunc
As the anonymous function was defined
as having 2 parameters
you have to provide 2 arguments
in our case 2 string VALUES "Alena" and "Lauren"

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**


**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**


Read the function-talk
http://javascript.crockford.com/code.html for the structure of the if-statement.


I have debugged it with your help.Thanks


Thanks a bunch, the explanation went a long way.