开发者

Multiple column logic in javascript [closed]

开发者_运维问答 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

Does anyone has the logic to display array of data in multiple column in java script like

1 2 3

4 5 6

7 8 9

and not

1 4 7

2 5 8

3 6 9

thank you


It's all how you step through the indices. Looks like you have your indices switched somewhere.

You're ordering by rows. You need to know how many rows and columns you have. Then your code will look like this (pseudocode):

for i = 0 to numColumns - 1
   for j = 0 to numRows - 1
      print array value at i + (numColumns * j)
   next
   print newline
next
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜