JS Daily #12 - Default Return Value of a Function

What is the output of following code?

function sum(a, b) {
  const result = a + b;
console.log(sum(2, 4));

Output is undefined.

If a function does not return a value explicitly, undefined is returned. Here, even though we found the sum, we did not return the result. Therefore, the default undefined is returned by sum().