Basic JavaScript - Return a Value from a Function with Return

Tell us what’s happening:
Describe your issue in detail here.

Hi everyone! So I passed this section, but I am seeking clarity on one part of the solution. What is the purpose of adding “(num)” at the end of my function’s title? Is Javascript able to always inetpret this as a numerical value will be used in the function, or is it just a placeholder to make the code easier to understand?

  **Your code so far**
function timesFive(num) {
return num * 5;
}

const answer = timesFive(5)
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Return a Value from a Function with Return

Link to the challenge:

num is just the name of the argument. You could name it whatever you want

function timesFive(puppies) {
return puppies * 5;
}

const answer = timesFive(5)

Though, it makes sense to pick a name that agrees with the logic. In this case, you will be multiplying by 5, so the input will end up being some sort of number, so you might as well call it number.

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