Functional Scope error


#1



Can't complete lesson even after clicking "get code" and reading other posts. Error: Did you write a console.log with the variable mailBoxNumber in it after the myApartment function?


var laundryRoom = 'Basement';
var mailRoom = 'Room 1A';

function myApartment() {
  var mailBoxNumber = 'Box 3';
  var laundryRoom = 'In-unit';
  console.log('Mail box: ' + mailBoxNumber + ', Laundry: ' + laundryRoom);
}
console.log('Laundry: ' + laundryRoom +  ', Mail: ' + mailRoom); 
myApartment();
console.log(mailBoxNumber);


#2

Add a semi colon after the closing bracket,

And remove this line,


#3

Same thing happened to me


#4

Same thing is happening to me.


#5

I'll hit run with the following code and keep getting this error message 'Did you write a console.log with the variable mailBoxNumber in it after the myApartment function?'

var laundryRoom = 'Basement';
var mailRoom = 'Room 1A';

function myApartment() {
var mailBoxNumber = 'Box 3';
var laundryRoom = 'In-unit';
console.log('Mail box: ' + mailBoxNumber + ', Laundry: ' + laundryRoom);
}
myApartment();
console.log(mailBoxNumber);


#6

I get it too...

Did I write a console.log with the variable mailBoxNumber in it after the myApartment function? Yes, yes I did. I also removed the semi colon after the end curly brace of the myApartment function. Same result.


#8

thank you bandit :smile:


#9

I'm stuck on this too... I have the same exact code as henaege. Please help me get as this, as i am learning this for a class I am taking in college.


#10

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