Javascript 2. Functional scope : 4


#1

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

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

myApartment();

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

Exercice : https://www.codecademy.com/fr/courses/learn-javascript/lessons/scope/exercises/functional-scope?action=resume


#2

Remove this console.log and your code should work,


#3

thanks :slight_smile: it worked well


#4

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