Pls anyone help me out from this problem

Tell us what’s happening:

Your code so far




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

//console.log(myVar);


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36.

Challenge: Local Scope and Functions

Link to the challenge:

You just had to declare the variable (var) called myVar in a local way (it means, inside a function) like this:

function myLocalScope() {
  'use strict';

  // Only change code below this line
   var myVar;
  console.log('inside myLocalScope', myVar);
}
myLocalScope();

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

Declare a variable can be just write it empty, like i do.

I guess the test is looking for the line:

  // Only change code below this line

Follow the directions closely. It’s telling you to only change code below that line. Don’t change anything else. An important part of being a good developer is following directions very closely, paying attention to minute details.

Thank you for responded me sir!! few mins i will check it and share u

Thank you very much sir!! it is done

No problem! keep learning (:

1 Like