Function


#1

var newNumber = function(timesTwo) {
console.log(newNumber);
};
timesTwo("6");

Im sure this is the right code but its not working for me, try it anyways.


Desperately need help!
#2

The code is not right.
Firstly, you're asking the console to log in the function(timesTwo) itself. However, the function has nothing to execute.
Secondly, you need to make the script return the value taken in by the parameter, times two.
Thirdly, timesTwo("6") is not valid here. The variable you defined was called newNumber. In your code, timesTwo is a parameter.
Finally, when you put "6", you're referring to a string, not a number.


#3

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