<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
I am shure its just a minor issue, but I cant seem to find the error.
The task is, to make all the necessary variables inside the function accessable to the console.log statement at the end (outside the function). I thaught that would be easy, since the only thing i have to do, is to remove the “var” in front of them. This should automatically set them to global and make them accessable to the console.log statement outside the function. Except it somehow does not
```
function myApartment() {
var myCoffeeMaker = ‘Aeropress’;
buildingAddress = ‘150 E 14th St, New York, NY’;
var myCloset = ‘Extra coats in the back’;
buildingLaundryCode = 4927;
var myRefridgerator = ‘Filled with veggies and dark chocolate.’;
var myDog = ‘Nikko’;
buildingPhone = ‘(481) 516-2342’;
}
// Do not edit the code after this line
console.log(“Apartment Building Information”);
console.log("Laundry code: " + buildingLaundryCode + "\nPhone: " + buildingPhone + "\nMailing address: " + buildingAddress);
Yes, you are correct. However, under further examination, the variable is
only available when called. For example, if I have…
function myFunc() {
var global = “I wanna be global!”;
}
The variable global is only accessible if I call it before I define it.
Weird huh?
I cant test whether it satisfies the codecademy exercise or not, but I did a quick test in my JS Editor and there my global function INSIDE the variable was not recognizes by the rest of the code unless I called the function befire I defined it. Just as you said.