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

  • Home
  • SEARCH
  • 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 8236397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:07:18+00:00 2026-06-07T19:07:18+00:00

When I add an extra 3 columns to the table my list items do

  • 0

When I add an extra 3 columns to the table my list items do not fill them. Instead it says undefined in the cells. If anyone can I ideally need a 6×6 table for my list items. Cheers.

var listOfWords = ["mat", "cat", "dog", "pit", "pot", "fog", "log", "pan", "can", "man", "pin", "gag", "sat", "pat", "tap", "sap", "tag", "gig", "gap", "nag", "sag", "gas", "pig", "dig", "got", "not", "top", "pop", "god", "mog", "cot", "cop", "cap", "cod", "kid", "kit", "get", "pet", "ten", "net", "pen", "peg", "met", "men", "mum", "run", "mug", "cup", "sun", "mud", "rim", "ram", "rat", "rip", "rag", "rug", "rot", "dad", "sad", "dim", "dip", "did", "mam", "map", "nip", "tin", "tan", "nap", "sit", "tip", "pip", "sip", "had", "him", "his", "hot", "hut", "hop", "hum", "hit", "hat", "has", "hug", "but", "big", "bet", "bad", "bad", "bed", "bud", "beg", "bug", "bun", "bus", "bat", "bit", "fit", "fin", "fun", "fig", "fan", "fat", "lap", "lot", "let", "leg", "lit" ];

var shuffledWords = listOfWords.slice(0, 6);
 shuffledWords.sort(function () {
   return 0.5 - Math.random();
});

var tbl = document.createElement('table');
tbl.className='tablestyle';

 for (var i = 0; i < shuffledWords.length; i++) {
   var word = shuffledWords[i];
   var row = document.createElement('tr');
 //Here is where I add the extra 3 columns
 for (var j = 0; j < word.length + 3; j++){
   var cell = document.createElement('td');


    cell.textContent = word[j];
    // IF FIREFOX USE cell.textContent = word[j]; INSTEAD
    row.appendChild(cell);
  }

  tbl.appendChild(row);    
}

document.body.appendChild(tbl);
  • 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-07T19:07:19+00:00Added an answer on June 7, 2026 at 7:07 pm

    If you are trying to display two words per line, you can do this:

    var listOfWords = ["mat", "cat", "dog", "pit", "pot", "fog", "log", "pan", "can", "man", "pin", "gag", "sat", "pat", "tap", "sap", "tag", "gig", "gap", "nag", "sag", "gas", "pig", "dig", "got", "not", "top", "pop", "god", "mog", "cot", "cop", "cap", "cod", "kid", "kit", "get", "pet", "ten", "net", "pen", "peg", "met", "men", "mum", "run", "mug", "cup", "sun", "mud", "rim", "ram", "rat", "rip", "rag", "rug", "rot", "dad", "sad", "dim", "dip", "did", "mam", "map", "nip", "tin", "tan", "nap", "sit", "tip", "pip", "sip", "had", "him", "his", "hot", "hut", "hop", "hum", "hit", "hat", "has", "hug", "but", "big", "bet", "bad", "bad", "bed", "bud", "beg", "bug", "bun", "bus", "bat", "bit", "fit", "fin", "fun", "fig", "fan", "fat", "lap", "lot", "let", "leg", "lit" ];
    
    var shuffledWords = listOfWords.slice(0).sort(function () {
        return 0.5 - Math.random();
    }).slice(0, 12);
    
    var tbl = document.createElement('table');
    tbl.className='tablestyle';
    var wordsPerRow = 2;
    
    for (var i = 0; i < shuffledWords.length; i += wordsPerRow) {
        var row = document.createElement('tr');
    
        for (var j=i; j < i + wordsPerRow; ++ j) {
            var word = shuffledWords[j];
    
            for (var k = 0; k < word.length; k++){
                var cell = document.createElement('td');
    
    
                cell.textContent = word[k];
                // IF FIREFOX USE cell.textContent = word[j]; INSTEAD
                row.appendChild(cell);
            }
        }
        tbl.appendChild(row);    
    }
    
    document.body.appendChild(tbl);
    

    Added a demonstration of this: http://jsfiddle.net/Ks2Nk/

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

Sidebar

Related Questions

So, the extra field in a queryset can be used to add additional columns
I have my code working, but I'm getting 2 extra columns in the table/ddl,
I am new in eclipselink and trying to add extra columns in manyTomany association
I have a table containing some numeric columns, and i have to keep them
I need to add extra validation to my DateField in Admin to make sure
How do I add an extra check to the default Symfony login_check? Most documentation
I'm trying to add an extra class tag if an element / value is
Suppose I have a Python class that I want to add an extra property
I use a jquery validation plugin and I need to add some extra checking,
I'm trying to subclass the built-in file class in Python to add some extra

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.