Calling the function -- https://www.codecademy.com/courses/functions_in_javascript/0/1

javascript
non-track-course

#1

Hi!

Can you help me please? Why doesn't this print out anything?:

Thank you, Kimmo H

function doubleMax(x, y) {
// add the correct function call after the '+' operator
return 2 * getMaxnum(5, 6);
};

// call me for help!
function getMaxnum(n1, n2) {
if (n1 < n2) {
return n2;
}
else {
return n1;
}
};


#2

Ok Ill help you soon, but try to read this topic. Thankyou


#3

Ok ill give you a hint to your problem. You didnt call the function..


#4

Hi!
I read it, is it it looking ok now? Best regards, KimmoH

  return 2 * getMaxnum(5, 6);
};

// call me for help!
function getMaxnum(n1, n2) {
    if (n1 < n2) {
      return n2;
    }
    else {
      return n1; 
    }
};

#5

Yeah its good. You forgot to call your function @kimmoh


#6

@amanuel2 But didn't I call it on line 3?
return 2 * getMaxnum(5, 6);
guess not...please give me another hint


#7

No you didnt. Thats the info it will return when you call that function. In this exercice im not sure whitch one it is but if your suppose to call getMaxnum this is how you do it:

getMaxNum(2,3)

If you still dont understand can you give me topic and topic number? Thankyou


#8

Hi! It's 11, Helper Functions/Review of functions in JavaScript. Still Don't get it right... @amanuel2

Now I get the right result 12 but it says "your code didn't print out*

function doubleMax(x, y) {
  // add the correct function call after the '+' operator
  return 2 * getMaxnum(x, y);

}; 

// call me for help!
function getMaxnum(n1, n2) {
    if (n1 < n2) {
      return n2;
    }
    else {
      return n1; 
    }
   
};

   doubleMax(5, 6);

#9

Same problem happens with me.
please, can any 1 help me.


#10

This post by moderator stetim94 was extremely helpful:

Review of functions in JavaScript: 11.Helper functions

It turns out the checking script for this exercise is looking for something oddly specific!


#11