Hi everyone, I am using the for loop function. I feel that my code is correct but something is wrong. I check for brackets and semicolon and they are in the right places and the right amount.

Can someone look at my code and let me know why it is not displaying/functioning. I am using the decrement operator with the for loop.
This code should make my code look like
0
1
2
etc

function ForTest()
{
	var OutPut="";	
	FillArray()
	for (var i=Numbers.length; i >= 0; i--)
	{
	OuPut = OutPut + Numbers[i] + "\r";
	} 
	document.frmMain.txtaOutput.value = OutPut;
}

Recommended Answers

All 3 Replies

The problem could be that you have this OuPut = OutPut + Numbers[i] + "\r"; instead of OutPut = OutPut + Numbers[i] + "\r"; the spelling of your output is wrong before the equal sign maybe if you could fix that everything else would be perfect

Thanks Traicey, I did not even notice that until you mention it. I put in the missing letter and it still not working. grrrrr

The problem could be that you have this OuPut = OutPut + Numbers[i] + "\r"; instead of OutPut = OutPut + Numbers[i] + "\r"; the spelling of your output is wrong before the equal sign maybe if you could fix that everything else would be perfect

oh my goodness, I feel so dumb. I found out what I was doing wrong. It was in my form. I did not let my form know that ForTest is a function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.