Return Keyword


#1

please tell me what i'm i doing wrong? here's my code :

// Parameter is a number, and we do math with that parameter
var timesTwo = function(number) {
return number * 2;
};
timesTwo(25);
// Call timesTwo here!
var newNumber = function (value) {
console.log("newNumber");
};


#2

Too complicated. This exercise is just to see how functions work.
So just executed the timesTwo function with e.g. timesTwo(25); and assign the result to a variable named newNumber. Then console.log the variable and your done.


#3

If that's your necessary code, the result of timesTwo(25) is not going anywhere, try console.log(timesTwo(25)); and you should get 50 logged.


#4

thanks for your help guys, i did what you've told me but the problem is that it keeps telling me ( it looks that you didn't print out the value of newNumber) but i did print it
var newNumber = timesTwo(25)
console.log("newNumber");
};


#5

Oh...newNumber is a variable, not a string. Remove the quotation marks and the extra };.


#6

thank u so much, it's finally working


#7

@systemslayer71824 can you put the full code please so I can watch it.


#8

never mind I already got it.