Return a value from a function

The first exercise is correct: doing the same to the 2° and 3° , the result is wrong… can anyone tell me why?

function timesFive(num) {
return num + 20;
}
const answer = timesFive(5);

function timesFive(num){
return num + 8;
}
const answer = timesFive(2);

function timesFive(num) {
return num + 0;
}
const answer = 0;
  **Your browser information:**

User Agent is: Mozilla/5.0 (Linux; Android 6.0.1; P01T_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.181 Safari/537.36 (Ecosia android@88.0.4324.181)

Challenge: Return a Value from a Function with Return

Link to the challenge:

The function is called timesFive, so I’m not sure why you are adding.

You should only define the function once.

'cause the test is:

  1. timesFive should be a function
  2. timesFive (5) should return 25
  3. timesFive (2) should return 10
  4. timesFive (0) should return 0

You need to return the num multiplied by 5. You also need to only declare the function once.

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