This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:web_development:tables:arrays [2021/12/10 07:28] mag [Multidimensional Arrays] |
en:web_development:tables:arrays [2023/08/16 09:33] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Web Development Lesson | + | ====== Web Development Lesson |
===== Javascript Multidimensional Arrays ===== | ===== Javascript Multidimensional Arrays ===== | ||
==== Objective ==== | ==== Objective ==== | ||
Line 5: | Line 5: | ||
==== Setup ==== | ==== Setup ==== | ||
- | * We'll add this as a page in our project, | + | * In your ' |
* Set up the template using ' | * Set up the template using ' | ||
* Also add a Javascript file using ' | * Also add a Javascript file using ' | ||
Line 150: | Line 150: | ||
* First, let's update our ' | * First, let's update our ' | ||
< | < | ||
- | | + | |
- | [' | + | [' |
- | ['Juan Guillermo', | + | ['Juan Guillermo', |
- | [' | + | [' |
];</ | ];</ | ||
* Note that each line is an element in the larger list, so we separate them by < | * Note that each line is an element in the larger list, so we separate them by < | ||
Line 179: | Line 179: | ||
* We've kept the variable name as < | * We've kept the variable name as < | ||
* < | * < | ||
- | * If you check the page again now, you'll only be showing the last player because we're overwriting the player data every time we call the function (< | + | * If you check the page again now, you'll only be showing the last player because we're overwriting the player data every time we call the function (< |
* Let's move the 'add row to table' block of code inside the 'for loop' so we display each row when the data is ready (and before we lose it). | * Let's move the 'add row to table' block of code inside the 'for loop' so we display each row when the data is ready (and before we lose it). | ||
< | < | ||
Line 201: | Line 201: | ||
// generate data | // generate data | ||
players = [ | players = [ | ||
- | | + | |
- | [' | + | [' |
- | ['Juan Guillermo', | + | ['Juan Guillermo', |
- | [' | + | [' |
]; | ]; | ||