Return keyword or just simple function


#1

this is code of exercise
var timesTwo = function(number) {
return number * 2;
};

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

and alternate way is

// This is what a function looks like:

var numberTwo = function (number) {
var val = number * 2;
console.log(val);
};

// On line 12, we call the function by name
// Here, it is called 'dividebythree'
// We tell the computer what the number input is (i.e. 6)
// The computer then runs the code inside the function!
numberTwo(8);

WHat is the diffrence y we used return plz explain


#2

@bitrockstar86410 when you use return, you can store the value in a variable. for example, if you call a function that uses a return command in this way:

var variable1 = functionName();

the value that is returned by the function will be stored in variable1, so you can use that value for other things.