Question about console.log

Tell us what’s happening:

while trying the challenge on switch statements, and reading the extra info on mozillas page, I noticed they used console.log right before the statement, but I don’t understand why. I tried console.log in front of my statements and it didn’t work. What is the difference between the examples on and my answer below?

Your code so far

function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
   switch (val) {
    case 1:
      answer = "alpha";
       case 2:
      answer = "beta";
       case 3:
      answer = "gamma";
       case 4:
      answer = "delta";
  // Only change code above this line  
  return answer;  

// Change this value to test

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.

Link to the challenge:

Your code shows a function which changes the answer variable which is returned at the end based on what input value it is given. console.log on the other hand, is simply printing a value, and not returning a value from the function, so while they may look the same, you want to be returning the value after the switch statement and not console.logging based on the case. If you do not return a value from the function, it returns undefined.