JavaScript - 13

JavaScript - 13: Functions with Return Values

Create a function called add that takes two numbers and returns their sum. Then create another function called multiply that takes two numbers and returns their product. Test both functions using console.log().

✦ JavaScript Editor
▶ Live Output

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

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

console.log("Addition:", add(8, 12));
console.log("Multiplication:", multiply(7, 5));