Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div id="putTableHere">
  
</div>

            
          
!
            
              table {border-collapse:collapse;border:1px solid #7f7f7f;background: rgb(34,193,195);
background: linear-gradient(246deg, rgba(34,193,195,1) 0%, rgba(152,253,45,1) 100%);}

td {border:1px solid #7f7f7f;width:50px;height:50px;text-align:center;}
            
          
!
            
              // For this project, you will use your knowledge of loops to create an HTML table and populate it with the products of 0-12 * 0-12, using only javascript
// Once you complete the program, you should see the table on the results pane with the values automatically filled in from your program

// 1. Declare a new variable, body, that references the putTableHere div from the HTML
// 2. Write a function called tablemaker
// Within the function tablemaker, declare a new variable, table, that creates a new table element.
// The js code to create a new HTML table is document.createElement("table");
// 3. Within the function, write a for loop that iterates 12 times, starting at 0
// Within the first for loop, declare a new variable, row, that creates a new row element.
// The js code to create a new HTML table is document.createElement("tr");
// 4. Write a nested forloop within the first forloop that also iterates 12 times, starting at 0
// Within the nested forloop, write a conditional statement testing if the first loop's iterator is equal to 0
// If so, execute the following code:
/*
                  let cell = document.createElement('td');
                  let cellText = document.createTextNode(j);
                  cell.appendChild(cellText);
                  row.appendChild(cell);
          */
// If not, write a conditional statement testing if the second loop's iterator is equal to 0
// If so, execute the following code:
/*
                  let cell = document.createElement('td');
                  let cellText = document.createTextNode(i);
                  cell.appendChild(cellText);
                  row.appendChild(cell);
          */
// Otherwise, execute the following code so that the product of the first loop's iterator and the second loop's iterator is placed inside of cellText:
/*
                  let cell = document.createElement('td');
                  let cellText = document.createTextNode(i*j); 
                  cell.appendChild(cellText);
                  row.appendChild(cell);
          */

// Outside of the second forloop, append the cell to the table by including the following code: table.appendChild(row);
// Outside of the first forloop and within the function, append the table to the HTML by including the following code:
//   body.appendChild(table);

// 4. Finally, call the tableMaker function and ensure that the multiplication table shows up in the results pane

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console