question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Local Scope and Functions issue with commented code.

See original GitHub issue

Challenge Local Scope and Functions has an issue. User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0. Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:


function myLocalScope(myVar) {
  myVar = 5; 
  
  console.log(myVar);
} 
//var myVar = 300;  
// LINE 7 IS WHAT I AM TALKING ABOUT.. IF I COMMENT  IT, I SUCCESFUL FINISH THE CHALLENGE.. BUT IF I DELETE LINE 7, IT DOESN'T WORK... and if I UnComment it, so it doesn't work too.. That's a bug
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope

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


Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
QuincyLarsoncommented, Aug 23, 2017

@systimotic Great detective work here, and thanks for resurrecting this old (but unresolved) issue.

Yes - I agree with your potential solution. Could you create a PR for this?

Regarding removing commented code before processing, this sounds like it would be a good long-term solution for this kind of situation, but would involve changes to the platform itself. So I’ll CC @BerkeleyTrue on this.

0reactions
QuincyLarsoncommented, Jun 3, 2018

I’m closing this issue as stale since it hasn’t been active lately. If you think this is still relevant to the newly updated platform, please explain why, then reopen it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CodeChallenge/Local Scope and Functions.md at master
Variables which are declared within a function , as well as the function parameters have local scope . That means, they are only...
Read more >
Local Scope and Functions - Guide
Problem Explanation. Local scope means that the variable is available within a certain area. In the case of this exercise, myVar is only ......
Read more >
Local Scope and Functions, freeCodeCamp Basic Javascript
In this challenge we learn about local scope and how variables in javascript that are declared inside of a function only exist in...
Read more >
Local Scope and Functions - Free Code Camp - YouTube
In this tutorial we go over another basic JavaScript lesson from FreeCodeCamp's basic computer programming course. Scope relates to where ...
Read more >
Global vs Local Scope in Functions - Free Code Camp
An experienced programmer goes over the global vs local scope in functions lesson which makes up a part of the FreeCodeCamp curriculum.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found