'Why "Undefined" in Javascript? [duplicate]

I started learning JavaScript and I was doing some exercises. I got undefined in Mozilla console. I am just curious about whether or not I'm missing something. Here's what I did.

function myFunction () {
  console.log("test call");
}

myFunction();

Code showing undefined in the devtools console



Solution 1:[1]

To return a value other than the default, a function must have a return statement that specifies the value to return. A function without a return statement will return a default value. In the case of a constructor called with the new keyword, the default value is the value of its this parameter. For all other functions, the default return value is undefined.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anton Marinenko