Return keyword


#1

Return keyword task

Why we are still here? Just to suffer.. What's wrong with my code? I got idea of return keyword, why it's not accepting it??

// Parameter is a number, and we do math with that parameter
var timesTwo = function(number) {
    return number * 2;
};


var newNumber = timesTwo
console.log(newNumber);
timesTwo(6)

Oops, try again. It looks like you didn't print out the value of newNumber

[Function]
12


#2

You have a problem when calling the function:

var newNumber = timesTwo(6); // ... and place here
console.log(newNumber);
timesTwo(6) // removed it ...

#3

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