JavaScript Question: How Do I Create a Multidimensional Array?

preview_player
Показать описание
Though true multidimensional arrays are not supported in JavaScript, you can accomplish a similar thing by creating an array of arrays. In this tutorial we look at how to set that up and then access the values.

To view the tutorial on for in loops:

For a complete list of all our tutorials:

Take the Learn Modern JavaScript: Getting Started or the Learn Modern JavaScript: Advanced Topics courses at a huge discount:
Рекомендации по теме
Комментарии
Автор

Man!!!! You are my javascript Jesus....

samrey
Автор

In the game im building i decided to go with an array of objects. that way not only do i avoid diving into nested arrays, but i can add extra params to my nodes as well like the sprite associated with it and the z-index and other neat things.
great video. im just now learning about matrixes and 2d array for an isometric game project. Was seeing if the way im using it is okay or innefficient?

richardguilliams
Автор

Finding the Sum of Rows and Columns in a Two-Dimensional Array javascript

kingelvis
Автор

I like writing games - as it helps learn a particular language. My language of choice this year is JS. With arrays, or objects I am stumped. I have for example, 20 mobs, each mob attacks in waves 9 times. Inside each wave is a set of criteria that needs to be met in order to beat that wave - example HP. I've tried several types of arrays but no go. In QB64/Pascal I can create a record and then assign that record to a var that is an array, PHP, I can jus tmake the arrays, and it will work verbatim, however, JS is very tricky when it comes to this. what would you suggest?

jakestone
Автор

So how do you say create a matrix like this, from a user input? Say if you have a user input a string of words, like this: "I love pizza, pasta, hamburgers, sausages"? I haven't been able to find any good material on how to do this.

hecatommyriagon