Hi All,
hope someone can see what wrong here I have the following function
function RemoveMenuFromH oldArray(menuNa me) {
var i = 0;
for (i=0;i<=MenusTo HoldOpen.length-1;i++) {
if (MenusToHoldOpe n[i] == menuName) {
MenusToHoldOpen .splice(i,1);
return;
}
}
}
I have found through trial and error that if I do not have the "var i
= 0;" line in the code, the function gets stuck in a loop.
can anyone tell me why , or where the logic is wrong?
Jul 20 '05
12 4907
"Richard Cornford" <ri*****@litote s.demon.co.uk> writes: Yes, I suppose the decision could have gone either way. It probably seemed easier, having traversed the scope chain to the global object in order to determine whether the identifier could be resolved to just add it as a property to that object rather than going back to the variable object in the execution context.
I doubt that is the reason. More likely it was to make it easier for
people who don't know the first thing about scopes, to write Javascript.
Making variables global removed the need for explaining scope.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
"Lasse Reichstein Nielsen" <lr*@hotpop.com > wrote in message
news:oe******** **@hotpop.com.. . Yes, I suppose the decision could have gone either way. It probably seemed easier, having traversed the scope chain to the global object in order to determine whether the identifier could be resolved to just add it as a property to that object rather than going back to the variable object in the execution context.
I doubt that is the reason. More likely it was to make it easier for people who don't know the first thing about scopes, to write Javascript. Making variables global removed the need for explaining scope.
Yes, maybe. Though making undeclared variables become global doesn't
remove the need to explain scope, it just delays it and allows a lot of
bad habits to develop in the mean while.
Richard.
On 2 Nov 2003 07:02:43 -0800, Lee <RE************ **@cox.net> wrote: re************ @hotmail.com said:
I wasn't thinking of them being special as such, just I thought that if it wasn't an already declared variable then it would be created locally, not globally. That obvioulsy isn't the case.
I may have gotten confused with another loagnauge I was looking at a while back, but If I was I can't remember which language.
Oh the things that you really miss from working with a compiliable language, like syntax checking and scope checking etc.
Most compiled languages require you to declare all variables. The fact that Javascript *doesn't* is what got you into trouble. Scope and syntax checking aren't much use if a typo can result in the creation of a new variable.
that what I meant. having to declare everything up front usually stops
things like this from happening. PLus you can check syntax etc,
without having to actually run the code This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ron |
last post by:
have been stuck on this for several days now.
I am trying to create a reverse polish calculator and I'm stuck at an
intermediate stage.
This is what I know I have to do (just not sure how to do it to much of a
newbie :( )
I'm trying to call method, isOp, in the int method, evaluate. While in INT
evaluate method and in a while(hasNextToken) loop. Calling isOp on each
token, nextToken.
If it returns False, convert to (Integer) and push...
|
by: GeorgeAtkins |
last post by:
VS 2003 using VB.NET
I'm writing a program that reads text entries from a one file and matches
them against values in an XML document. However, the code seems to just sit
in the loop and never get anywhere, yet no errors occur. I tried this
hard-coding a title known to be in the XML file and it worked ok. It seems to
"hang" when the title is not found, but that's just a guess. Here is the code:
Imports System.Xml
Imports System.Text...
|
by: Mark Phillips |
last post by:
Hello,
I am having a problem in which a file can get stuck open when a thread
that is attempting to write to it gets aborted (ThreadAbortedException
occurs). The log file gets stuck open until the process is shut down
(cannot delete file from Windows Explorer, for example). My test
application stops execution with:
An unhandled exception of type 'System.IO.IOException' occurred in
mscorlib.dll
Additional information: The process...
|
by: Rene |
last post by:
I got stuck on an infinite loop on the "Paint" event of my custom control
and I was not able to "ctrl-break" my way out of it.
After trying everything, I had to ctrs-alt-delete to shut down the
application and delete the bin and obj folders of the control so that the
application could start without locking.
I don't understand? I am pretty sure I was able to press ctrl-break before
and it would stop on the offending line. Could this be...
|
by: Mike D |
last post by:
Attached is my code. Which I know there is a better way of writing however
this is what I came up with and it works until the value is null or not = to
the <> value.
'Do While rdrSQL.Read()
'While rdrSQL.Read()
' Dim result As String
' result = Trim(rdrSQL.GetString(0))
| |
by: steve marchant |
last post by:
trying to learn VB6. Simple counting loop which counts to 8 in 1 sec
intervals, then starts from 1 again and repeats.
Have two Command buttons on the form. Cmd1 starts the counting, and I need
to know how to stop it with Cmd2. Here's my code so far:
Private Sub Command1_Click()
Dim x, y, m
m = 1
Do
Print m
|
by: Tom C |
last post by:
We have a window named FormApplication which just happens to be our
mid parent window. When I open it in the designer, it is stuck in a
loop redisplaying a c1flexgrid. maxing out our cpu's. By attaching to
the process from another visual studio, I can get it to break on some
user code with this huge callstack, most of which is native. So are we
instantiating something in design mode that we should not be? Does
this mean anything to anyone?...
|
by: hexusnexus |
last post by:
I wrote a simple algorithm and it keeps getting stuck in a loop. I
guess I'm just to tired to figure it out:
compcount=
suitrank=
trump=2
l,lt=0,0
while l<4:
while lt<4:
|
by: Cainnech |
last post by:
Hi guys,
I'm a bit stuck in an infinite loop. What I'm trying to do in the code below is to compare two arrays and if there's an item in array ALGEMEEN that is not in array ITEMS, I want to add it to ITEMS.
Now the ITEMS-array looks like this:
items=;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |