Tell us what’s happening:
it says “oopsGlobal is not defined” did i not define it?? i said it was 5, i’m so lost. javaScript makes me feel like i’m blind and i am trying to learn how to drive. like i know what it does technically… i think. but how does any of the stuff covered so far in these lessons actually work on a web site i have no freakin clue and i think knowing that would make this so much easier.
Your code so far
// Declare your variable here
var myGlobal = 10;
function fun1() {
// Assign 5 to oopsGlobal Here
oppsGlobal = 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);
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions