Freecodecamp: Local Scope and Functions - doesn't work

Created on 17 Jan 2016  路  26Comments  路  Source: freeCodeCamp/freeCodeCamp

Challenge Local Scope and Functions has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

function myFunction() {
  'use strict';

   var myVar = "test";  
  console.log(myVar);
}
myFunction();

// run and check the console 
// myVar is not defined outside of myFunction
console.log(myVar);

// now remove the console log line to pass the test


href="http://content.screencast.com/users/Pisstt/folders/Default/media/d1d59d3a-6ca0-493b-9910-3c421028f88b/2016-01-17_1925.png">

Most helpful comment

function myLocalScope() {
'use strict';
var myVar = "teste";

console.log();
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log();

// Now remove the console log line to pass the test

All 26 comments

// run and check the console 
// myVar is not defined outside of myFunction
console.log(myVar);

// now remove the console log line to pass the test

Please visit the Help Chat for help. Github issues are not for challenge help. Thanks and happy coding!

@ltegman As a suggestion on usability, it would be great to update the challenge since it is not clear what you need to do to pass it. You follow the instructions and you expect the output on the left side. The instructions and outcome are always on the left. The challenge asks you to define myVar, you complete the required line then the message shows you that you didn't. I (as user/student) am not used to read the comments on the right side and you are focused between the requirement and the updated line. Then, oh, there is a line to be removed but there is no clue that you need to follow the comments. I didn't notice that.

At least, it would be great to show the error line. I saw that there was an opened issue regarding the challenge. So, it is not a single case.

Thanks.

Even when you manage to add a local variable and then follow the directions in the comment to remove the last console line you still can't pass the test....

@sandyvern - I had the same issue and just had to do a refresh and it worked. Hope it fixes it for you too.

Also required a refresh for this to work, did not work initially.

I had the same issue

Hm. After refresh it worked, thanks!

can confirm this is a bug. need to refresh in order to pass.

Was getting pretty desperate thinking of what I'd done wrong. Thank you commenters for confirming this is a bug. Refresh did it for me.

I had the same issue.
The code was correct but it was considered wrong.
After a refresh (F5) the same code was considered correct.

I am using Chrome v48.0.2564.109 m
Is there any way to reopen this issue? I think it is definitely a bug!

Yep, requires a refresh to make it work.

Still an issue, refresh worked for me as well.

Need to refresh to make t work

Hello Everyone!
We sincerely apologize for the inconveniences that you all have been facing.

I am not 100% sure how to tackle the Refresh issue that you have been facing ATM, but We are really are open for any way that can help you overcome this.

Coming to the clarification as pointed in the comment above by @tzupoaia
We could address that, along with a possible hint to refresh if you are stuck?

Please let us know what would be the best way.

/cc @FreeCodeCamp/issue-moderators Should we re-open this?

Note to contributors:

  1. Adding additional information in the instructions to go through the Comments might help the confusion.
  2. Also add something on the lines to refesh the browser if you are stuck

camp

To consider the comment here while trying to resolve this?

stucked in here too

Had to refresh in order to past the tests. There's still a bug here.

+1

function myLocalScope() {
'use strict';
var myVar = "teste";

console.log();
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log();

// Now remove the console log line to pass the test

Edit: I made a mistake. Please ignore this comment.

+1

I already removed a line that contain console.log(myVar); and refresh my browser both in Safari and Chrome but still stuck in that Local Scope and Function Challenges.

I had to refresh as well on Chrome

This is still happing.
I had to reset the code, redo the code, then refresh, then run tests to make it work.

Hey all. i did the refresh . worked like a charm. thanks! . Ps on Chrome

Yep this challenge is vaguely worded. Then there is that comment 'use strict' that for newbies like me causes utter confusion. The fact that you have to reset the code and refesh browser does not help. This is like the umpteenth challenge where I had just about given up and came back and tried with same code and worked. without explanation why it failed the first 1000 times i tried . funny that i just wrote

var myVar = "myVar"; .....and it worked. Then i deleted the second console.log ..and it worked. ps. on chrome

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielonodje picture danielonodje  路  3Comments

MichaelLeeHobbs picture MichaelLeeHobbs  路  3Comments

SaintPeter picture SaintPeter  路  3Comments

raisedadead picture raisedadead  路  3Comments

kokushozero picture kokushozero  路  3Comments