We have sent values to a function, but what about getting information back? All functions return to the location from which they are called and they return data using the “return” keyword. If you do not use the “return” keyword, the function will return “undefined”.
function add( num1, num2 ) {
let newNum = num1 + num2;
return newNum;
}
let addSum = add( 1, 2 ); // Variable to hold function call. Allows ease of use.
console.log( addSum ); // Displays 3
Happy Coding!
Clay Hess