I don't understand the return function!


It works!

var timesTwo = function(number) {
return number * 2;
var newNumber = timesTwo;

It comes up with 4 as it should! But how do I call it up again? I guessed it was:


but it just comes up with:

[Function: timesTwo]

So how do I call it up again if I need it later! Do I have to use:


to call it up again?


timesTwo is a function that needs an input(parameter) to call it eg

var num = 5;

You can't simply assign a function to a variable and ditch their parameter. So you have to do

var newNumber = timesTwo(randomNumber);


Thanks lots bro/ sis!


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