JavaScript - 13

JavaScript - 13: Functions with Return Values

Create two functions: one that adds two numbers and returns the sum, and another that multiplies two numbers and returns the product. Test them with console.log().

✦ JavaScript Editor
▶ Live Output

👀 Show Solution
function add(a, b) {
  return a + b;
}

function multiply(a, b) {
  return a * b;
}

console.log("5 + 7 =", add(5, 7));
console.log("6 * 8 =", multiply(6, 8));