Freecodecamp: Global Scope and Functions on beta.freecodecamp

Created on 21 Jan 2017  路  11Comments  路  Source: freeCodeCamp/freeCodeCamp

Answer is not accepted on the Beta Freecodecamp. "Do not declare oopsGlobal using the var keyword" is the only issue showing up.

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

My code:


// Declare your variable here
var myGlobal = 10;

function fun1() {
  // Assign 5 to oopsGlobal Here
  oopsGlobal = 5;

}

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}

help wanted

All 11 comments

Hi @myleschatman! Thank you for reporting this issue.

Your code works fine for me. Can you refresh and try again?
Do you see any errors in the console? I'm not sure how to open it in Safari, but I know it's Cmd + Shift + J in Firefox and Chrome.

Some other things to try:

  • Run in incognito mode
  • Try in a different browser

Hello @systimotic. Thank you for this suggestions. I tried all of your suggestions in the Chrome Browser as well in Incognito Mode and still receiving the same issue. Here is an image of the console window.

incognito

@myleschatman Sorry, I wasn't paying attention and missed that you were talking about the beta! 馃槄
I can confirm that this issue is occurring on beta.

The tests for this challenge are here, but this particular test hasn't been changed from the current live version.
I suspect this might have something to do with the tail not being run anymore, or with an update to the testing framework.

@systimotic Ah ok! That makes a lot of sense. Thanks for the update. :)

I found the source of the issue!
var oopsGlobal; is in the head here. This is now an issue because the head and tail are now included in the tests (https://github.com/freeCodeCamp/freeCodeCamp/issues/10258)

Removing the definition from the head fixes the browser tests, but it breaks the CI tests.

@freeCodeCamp/moderators
What would work, is moving var oopsGlobal; to the beginning of the solution, although that seems a bit hacky to me. Should I go through with that?

Needs a bot more creative solution though, will take a look when I can, but keeping open for others to pitch in.

@raisedadead I noticed that on other challenges where the head or tail were causing issues, the solution was removed entirely. Should we also do that here?

This would also be helpful for the challenges where the head or tail is causing an issue.

Experiencing the same issue.

Any status on when this will be fixed?

@rmdawson71 I think @raisedadead plans to tackle this. I'm going to assign him to the issue. He has a lot of other things he's working on currently, but this will be fixed before we ship to production.

Ran into same problem running with Chrome on Ubuntu Linux 16.10. Here is my code:

// Declare your variable here

var myGlobal = 10;
function fun1() {
// Assign 5 to oopsGlobal Here
oopsGlobal = 5;
}

// Only change code above this line
function fun2() {
var output = "";
if (typeof myGlobal != "undefined") {
output += "myGlobal: " + myGlobal;
}
if (typeof oopsGlobal != "undefined") {
output += " oopsGlobal: " + oopsGlobal;
}
console.log(output);
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trashtalka3000 picture trashtalka3000  路  3Comments

vaibsharma picture vaibsharma  路  3Comments

danielonodje picture danielonodje  路  3Comments

robwelan picture robwelan  路  3Comments

bagrounds picture bagrounds  路  3Comments