LOCAL SCOPE and solution

HI GUYS, I have 2 questions. first , as u see in the attached photo why in the solution is not determined type of variable, in this case loc. I mean why it’s not written var loc = my Var;


and other question : what is missing on my code.
thanks



**Your code so far**
      
```js

function myLocalScope() {

// Only change code below this line
var loc = "myVar";
console.log(loc);
}
myLocalScope();
var loc = "myVar";
// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(loc);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5.

Challenge: Local Scope and Functions

Link to the challenge:

Hi there,
You should define a variable exactly as myVar. Don’t change the name
This is the instruction on the FCC and you should follow that. If you are practicing this code on the editor, then you can change it.

1 Like

in this case you are not determining the type of a variable, JavaScript doesn’t do that
instead the name of the variable is right after var, and the content of the variable is after the =

the challenge asks for a variable named myVar, so you need to put that as variable name

1 Like

@anon58011934 @ilenia thanks u so much. could u tell me what is use of console.log and why we use it?

it is a debugging tool, it prints to the console what you put inside it

1 Like

thanks. Then , is it necessary to put it. right?

no, in general it is not necessary, it has no effect on the code flow and logic, it is just a debugging tool

it is a requirement for this challenge tho

1 Like

ok , got it. thanksss