Not being able to pass 2. Functional Scope

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

https://www.codecademy.com/courses/learn-javascript/lessons/scope/exercises/functional-scope?action=lesson_resume&link_content_target=interstitial_lesson

The exact question that I’m stuck is #4, “Now, let’s try to see the mailBoxNumber outside the function. On the last line of the program, write: [console log code here]”

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

When I submit the answer below, it still doesn’t pass me. What am I doing wrong?

The error message that I am getting is:
“Did you write a console.log with the variable mailBoxNumber in it after the myApartment function?”

```

var laundryRoom = ‘Basement’;
var mailRoom = ‘Room 1A’;

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

myApartment();
console.log(mailBoxNumber);

<do not remove the three backticks above>

Hi,
Yes,I am having the same problem. My code looks identical to yours.

I was having the same problem… I put the
console.log(mailBoxNumber);
before:
myApartment();

like this:

var laundryRoom = ‘Basement’;
var mailRoom = ‘Room 1A’;

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

};

console.log(mailBoxNumber);
myApartment();

and it finally worked for me :slight_smile:

6 Likes

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