Correct code not being accepted


JavaScript: Lesson 4 exercise 2 (Scope)

Unless I'm missing something, the exercise doesn't accept correct code.

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

function myApartment() {

console.log('Laundry: ' + laundryRoom +  ', Mail: ' + mailRoom);

Here's an image of the code I wrote, next to the hint:
Copypasting the code from the hint into the exercise made it work, even though nothing had changed.

The same happened on the previous exercise, I'd written the correct code and it didn't let me advance until I clicked the "get code" button, which also gave me a bunch of unnecessary code I had to delete. The code that remained was the same as the code I'd written previously.


That course does a whole lot of pattern matching on your code and that can get really finicky
The pattern for that checkpoint is:


The code you posted does match that though. I would try refreshing the browser and pasting what you posted back in (perhaps something didn't load quite right, lost track of which file you were updating vs which one it was checking.. but that's just speculation)


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