javascript For statement moving thru rows and cols

Hello Experts

Need to get a JavaScript statement to write out the sequence listed below.

Started with

var indexRow;
var indexCol;

for (indexRow = 0, indexCol = 0; indexRow = 0, indexCol <= 7; indexCol++)
document.write(indexRow + "&nbsp;" +indexCol "<br>" );

Just to get the column to index while the row stays the same
seven times  but this is not working. And I have no
idea how to increment row one after the col gets to seven
and then make the row stay at 2 while the col increments again
and so on.

Any ideas?


Allen in Dallas

+++ Sequence begin+++++++
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
1 0
1 1
1 2
1 3
1 4
1 5
1 6
1 7
2 0
2 1
2 2
7 5
7 6
7 7
+++ Sequence end+++++++
Allen PittsBusiness analystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
this should work:
var indexRow;
var indexCol;

for (indexRow = 0; indexRow <= 7; indexRow++)
  for (indexCol = 0; indexCol < 8; indexCol++) {
   document.write(indexRow + "&nbsp;" +indexCol + "<br/>" );

Open in new window

You will need two nested for statements.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rainer JeschorCommented:
Allen PittsBusiness analystAuthor Commented:
Hello Rainer,

Works great.

Actually this is for a C++ routine that is used in a piece of code
employed by a microprocessor called Ardunio
The excellent nested For statement described would work on
one chip called Max7219  which can control 64 LEDs.
The intent, however is to daisy chain five Max7219's to allow the control of
340 LEDs. (64 x 5)
So the code will have three variables beginning
(0,0,0) to (5,7,7) where the integers indicate
(chip, row, column)
So it is assumed that a third level can be added.


Allen in Dallas
Rainer JeschorCommented:
Hi Allen,

sure - I updated the jsBin sample:

But it would be
0-4 | 0-7 | 0-7

Thanks for the points and good luck with your Ardunio - as soon as my twin boys are old enough, some new gadgets for daddy :-)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.