Function Review


#1


https://www.codecademy.com/en/courses/spencer-sandbox/2/1?curriculum_id=506324b3a7dffd00020bf661#

Somehow, I managed to solve the exercise. However, I don't quite understand the instructions and hint given.

Instructions:

Define the function multiply. It should take two parameters, x and y, and return the product.

Then call your function, passing in any two arguments.

Hint:

Use square as a guide to write multiply. This time, you will have two parameters, and these should be separated by a comma inside the function's parentheses.

To call the function, just type the name of the function, followed by the arguments you want to pass. For example, if we wanted to call square, we would use square(2);

Those that are in bold, I don't really understand. What does it mean to 'call' the function?
And square(2)??

// Accepts a number x as input and returns its square
var square = function (x) {
  return x * x;
};

// Write the function multiply below
// It should take two parameters and return the product

var multiply = function (x,y)
{ return x*y;}
multiply (5,6)


#2

check it here
https://discuss.codecademy.com/t/i-do-not-understand-how-to-call-a-function-what-am-i-doing-wrong/37701/7?u=rcodeman

if you still have a question then please dont hesitate :slight_smile:


#3

Thanks! Your explanation in the thread really helps! :slight_smile:


#4

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