Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Practice: Multi-Dimensional Arrays

A small Node.js practice exercise modeling a library with shelves of books and movies using a 2D array. The focus is bracket notation only — no for...of loops and no array methods like forEach for the access tasks.

What it does

The script defines a library 2D array (3 shelves × 3 items each = 9 items total) and demonstrates the following:

  1. 2D array with at least nine items split across shelves — declare library.
  2. Access and log every element using bracket notation with literal numbers — log each item via library[row][col].
  3. Access using variable indices row and item — nested for loops walk the whole structure.
  4. Loop printing only the second shelf (index 1) — iterate just library[1].

How to run

Prerequisites: Node.js installed.

# from the project root
node index.js

You should see every item printed three ways: by literal index, by variable index with shelf/item labels, and finally just the second shelf.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages