Solved

Why do I not have to use "window." every time?

Posted on 2014-07-17
3
116 Views
Last Modified: 2014-08-14
I have a global variable:
aa_pageNameTypeURL

Open in new window

Should I use "window.'" every time I reference this variable? What are the pros/cons?
window.aa_pageNameTypeURL;

Open in new window

0
Comment
Question by:894359
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40203501
<< window. >> make your variable global which mean accessible to everywhere in your page by any javascript code
if you are in a function and use << var aa_pageNameTypeURL = foo >>, aa_pageNameTypeURL is only available in the function.
Google about "javascript scope" to learn more
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question