Can anyone help me please with the solution to this problem

Can anyone help me please with the solution to this problem
0

#1

Tell us what’s happening:

Your code so far

function myLocalScope() {
  
  var myVar = "Lawrence";
  
  
  console.log(myVar);
}
myLocalScope();


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

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36.

Link to the challenge:


#2

@nyannue,
read the instructions carefully. It says to follow the comments inside the exercise.

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

You should remove:

console.log(myVar);

and you shall pass the test


#3

Thank you, I am really finding it difficult with this course because I am a beginner in programming.


#4

It has worked for me, but please be a helper to me. I really want to learn coding at freecodecamp, but I am not still understanding what I am doing.

I will be glad if you can please give me your contacts.
Here are mine:
Tels: +231 778314079/880956709
Emails: [email protected]/[email protected]
Facebook: Lawrence Phillips/ nyannue Flomo


#5

It is highly recommended to not post phone numbers or email address on the forum, to keep you from being solicited by bots and other scammers.


#6

This piece seems to be touching on the topic of Scope (more info).

Scope comes in many flavors. To define your scope you could ask, what can your code access? What variables can it reach and use?

Everything your code can touch, is yourscope. It can be a confusing topic at first. Also , note that detailed and focused questions are a good way for allowing others to best address the parts you are having trouble with.

A Google search for JavaScript Scope would give a lot of examples and reads. I’ll list a few I like at the bottom.

Wikipedia - JavaScript Scope

MDN - Function Scope

W3Schools - JavaScript Scope

:slight_smile: ~Happy Hacking~