Can someone explain this error?


#1

Error Message: Did you write a console.log with the variable mailBoxNumber in it after the myApartment function?

This is my code:

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(mailBoxNumber);


#2

console.log(mailBoxNumber);

The variable named mailBoxNumber outside of function is undefined.
for more details check here

now remove that line.you should call the function by function name instead.like

myApartment()

though i didnt do that lesson.can you please give me the lesson link so i can see that


#3

Here is the link. I understand that the variable exists only inside inside the function. That was the whole point of the lesson. Tell me I'm crazy, but Codecademy won't let me move on because I can't get past instruction number 4.


#4

function myApartment () {

remove space between myApartment and () then try :slight_smile:
should be

myApartment()


#5

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