Help with newby Javascript problem

Hai Guyz,

So I’ve been stuck on the same problem all afternoon. I wrote var = myVar; underneath line number 4. I’ve tried talking posting on Facebook. I’ve also tried myVar = 10, but nothing seems to work. what am I doing wrong?
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions

Try resetting the code, and defining your myVar only on line 5. I’m not sure why you’re getting a SyntaxError so trying a clean copy might fix it.

Try to refresh the page, I wrote the same code and everything is fine

function myLocalScope() {

  'use strict';

  // Only change code below this line

  console.log('inside myLocalScope', myVar);  

    var myVar = 1;

}

myLocalScope();

// Run and check the console

// myVar is not defined outside of myLocalScope

console.log('outside myLocalScope', myVar);

Is there a way to skip this problem? I have tried switch browsers and everything. I noticed you wrote your line beneath the console.log but that still doesn’t work for me.

You do not have to complete the lessons to earn the certification, only the projects.
As long as you understand what the lesson is demonstrating, you should be fine to skip it. But the fact that we haven’t found a solution to this bug is concerning, as it may indicate possible issues you’ll have with further lessons.
I wish I could reproduce it to provide a proper bug report. You’ve tried clicking “Reset all code” right?

Yes, many times. I am actually trying to learn code for something called Code Platoon, which requires you to solve some problems on your own before they’d accept you for an online boot camp. They listed this website as a free resource for learning code. Is there like a way to see all the lessons?


Just declare a variable inside the function and don’t assign anything.
It works fijn for me.

There is! You can click through the sections and see the lessons on the main Learn page.

Hello!

This does not seem to be an issue with the user’s code, but seems to be a bug instead.

He declares a variable after logging it in the console.
Need to declare a variable first and the log it in the console.


While you are correct, it does not prevent the tests from passing for this particular lesson.

Thats right :grinning: