I don't get this?


What I don't get is shouldn't there be a variable beforehand that defines the number 8 or another number as in var numHours =8;
I mean it is correct for the lesson but how? How do we know how many hours numHours is?

// Write your function below. 
// Don't forget to call your function!
function sleepCheck(numHours){
    if (numHours >= 8){
        return "You're getting plenty of sleep! Maybe even too much!";
        return "Get some more shut eye!";   


function parameters (numHours) are placeholders until you call the function, then the value you supply as argument gets copied into numHours


Yeah I think since I am more used to PHP is where i am confusing things


php has the same concept of functions and parameters:

         function addFunction($num1, $num2) {
            $sum = $num1 + $num2;
            echo "Sum of the two numbers is : $sum";
         addFunction(10, 20);

i don't see any difference in concept?


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