Why the return function doesn't always return value on the screen?

I am learning JavaScript with freeCodeCamp and I stumbled upon something really unique.

var outerWear = "T-Shirt";

function myOutfit() {
  return outerWear;


The output for the above code is nothing on the screen.
While, when I do this:

function plusThree(num) {
  return num + 3;
var answer = plusThree(5);

The output for the above function is 8.

How come the return gives output on the screen in the second function but not with the first?

Because the return value of a variable assignment expression is undefined.

Whereas the return value of a function call is, well, the returned value itself unless the function doesn’t specify a return value; thus making the value undefined

this seems to be a quirk in the freecodecamp editor
the only way to be sure to see something in the console is to use console.log()


Will I get an error like “something is undefined” on the console ?

Does “return” ever return a result on the screen? @ieahleen

no, return specify which value is returned from the function, by itself it doesn’t show anything on the screen
there are some commands that instead makes something show in the console, and console.log is one of those

Hah. Finally, got it.