7. Return Keywords


#1


What am I doing wrong?

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

// Call timesTwo here!
var newNumber = timesTwo(8){
console.log(newNumber)
};


#2

Heres how you would do it:

var newNumber = timesTwo(8); 
/*We pass 8 into timesTwo which multiplies it by 2 and returns it.  We store the returned code in newNumber.*/
console.log(newNumber)
//We print the new number.

#3

Thank you Sgt. JavaScript is currently kicking my tail but ill get the hang of it!


#4

Yes sir. Keep practicing, paying attention to the fine details in the lesson, and reading your error messages! :grinning:


#6

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