Solved

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

Posted on 2014-07-17
3
112 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to dynamically set the form action using jQuery.

706 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now