2. Functional Scope: Printing 'undefined'



I dont have any error messages. I've entered all the code in correctly and the program is letting me move on to the next lesson. But for some reason the word "undefined" printed at the bottom of my output.
Does anyone know why the program is adding text at the end of my output?

var laundryRoom = "basement";
var mailRoom = "Room 1A";

function myApartment(){
  var mailBoxNumber = "Box 3";
  var laundryRoom = "In-unit";
  console.log('\nMail box: '+ mailBoxNumber + '\nLaundry: '+ laundryRoom);

console.log('Laundry: '+ laundryRoom + '\nMail: ' + mailRoom);



It's because of this. There's no need for a console.log around calling a function.

So you call your function like this myFunction()
One console.log, one function call.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.