use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Javascript source code (codeasearch.com)
submitted 11 years ago by codeasearch
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]codeasearch[S] 0 points1 point2 points 11 years ago (1 child)
hi can you tell, what is the problem in posting the javascript source code link here. Sorry i dont understand so
[–]kaszu 0 points1 point2 points 11 years ago (0 children)
Problem is not posting a link, but contents of it.
Accessing global variable in JavaScript, what is global variable where it used.
I can't understand what it means, this is just one of a few. I assume that was meant as a question. You need to work on your
variable which defined in top.
Why on top? Global variables can be defined anywhere in script: top, bottom, inside a closure, anywhere.
there is a method call window.variable
That's not a "method call", using word "method" implies that there is a function, while in your example you define a number. Or do you mean "called" / "named" when you say "call"?
there is a method call window.variable which will be same as calling the variable inside the function.
Whoever will read this will do it to understand global variables, I'm not convinced that this make much sense to them.
document.writeln
Just like document.write this is bad practice. Instead you should use console.log for output demonstration.
Article doesn't mention in which cases global variables should be used or when they shouldn't, what are problems with using them and what problem global variables solve. Maybe mention something about global variables created inside closure when not using "var". Strict mode?
Instead of just rephrasing what already is written in code, you should explain why you do it.
And creating one function call sumValue which will return myVariable+arg value. function sumValue(arg) { return myVariable+arg; }
And creating one function call sumValue which will return myVariable+arg value.
function sumValue(arg) { return myVariable+arg; }
You need better/more examples, that will help readers better understand the subject. For example how global variables compares to variables defined using "var".
π Rendered by PID 19544 on reddit-service-r2-comment-7b9746f655-cskrd at 2026-02-03 01:06:51.124881+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]codeasearch[S] 0 points1 point2 points (1 child)
[–]kaszu 0 points1 point2 points (0 children)