Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8758509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:34:01+00:00 2026-06-13T14:34:01+00:00

hey guys i have a situation here. i have a code that out puts

  • 0

hey guys i have a situation here. i have a code that out puts a two dimensional here it is.

<script>
    Brady = new Array(3);

    for (i = 0; i < Brady.length; ++i) {
        Brady[i] = new Array(5);
    }

    Brady[0][0] = "Team 1";
    Brady[0][1] = "Carol";
    Brady[0][2] = "Greg";
    Brady[0][3] = "Greg";
    Brady[0][4] = "Greg";

    Brady[1][0] = "Team 2";
    Brady[1][1] = "Alice";
    Brady[1][2] = "Peter";
    Brady[1][3] = "Peter";
    Brady[1][4] = "Peter";

    Brady[2][0] = "Team 3";
    Brady[2][1] = "Mike";
    Brady[2][2] = "Bobby";
    Brady[2][3] = "Bobby";
    Brady[2][4] = "Bobby";




    function print_2d_string_array(array) {
        document.writeln("<table border>");

        var row;

        for (row = 0; row < array.length; ++row) {
            document.writeln(" <tr>");

            var col;

            for (col = 0; col < array[row].length; ++col) {
                document.writeln("  <td>" + array[row][col] + "</td>");
            }

            document.writeln(" </tr>");
        }
        document.writeln("</table>");
    }

    print_2d_string_array(Brady);
</script>

with an out put of:

Team 1  Carol   Greg    Greg    Greg
Team 2  Alice   Peter   Peter   Peter
Team 3  Mike    Bobby   Bobby   Bobby

but what i want to do is

Team 1  Team 2  Team 3
Carol   Alice   Mike
Greg    Peter   Bobby
Greg    Peter   Bobby
Greg    Peter   Bobby

ive been spending an hour to do that but im out of luck.. plss help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:34:02+00:00Added an answer on June 13, 2026 at 2:34 pm

    Try:

    <script>
    Brady = new Array(3);
    
    for (i = 0; i < Brady.length; ++i) {
        Brady[i] = new Array(5);
    }
    
    Brady[0][0] = "Team 1";
    Brady[0][1] = "Carol";
    Brady[0][2] = "Greg";
    Brady[0][3] = "Greg";
    Brady[0][4] = "Greg";
    
    Brady[1][0] = "Team 2";
    Brady[1][1] = "Alice";
    Brady[1][2] = "Peter";
    Brady[1][3] = "Peter";
    Brady[1][4] = "Peter";
    
    Brady[2][0] = "Team 3";
    Brady[2][1] = "Mike";
    Brady[2][2] = "Bobby";
    Brady[2][3] = "Bobby";
    Brady[2][4] = "Bobby";
    
    
    function print_2d_string_array(array) {
        document.writeln("<table border>");
    
        var col_len = array.length;
        var row_len = array[0].length;
    
        for (var i = 0; i < row_len; i++) {
            document.writeln("<tr>");
            for (var j = 0; j < col_len; j++) {
               document.writeln("<td>" + array[j][i] + "</td>");
            }
            document.writeln("<tr>");
        }
        document.writeln("</table>");
    }
    
    print_2d_string_array(Brady);​
    </script>
    

    This will output:

    Team 1  Team 2  Team 3
    Carol   Alice   Mike
    Greg    Peter   Bobby
    Greg    Peter   Bobby
    Greg    Peter   Bobby
    

    Here’s a JSFiddle example: http://jsfiddle.net/uNPXa/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I have my script here that is supposed to do some stuff
Hey guys I have one more question lol. I am using a script that
Hey guys I have an array of dictionaries plist file that I am reading
Hey guys i have a question here, How do i create a body that
Hey guys I have an admin page that checks if you are admin before
Hey guys I have an assigned array from mysql results and I simply want
Hey guys I have a little issue here. I have a panel where I
Hey guys I have a query that currently finds the latest comment for each
Hey guys I have what should be a simple question, but I am new
hey guys having this really simple problem but cant seem to figure out have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.