CodingTrain / CodingTrain/Suggestion-Box

p5.js tutorial - advanced arrays (jagged 2d array of objects)

Đang mở
#397 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Help wanted Suggestion
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
570
Fork
85
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

A follow up to tutorial 9.12: 2D Arrays in JavaScript

Data doesn't always come in neat 4x7 element packages; sometimes it is irregular. I'm not entirely sure what the represented limits are in p5.js - I believe you can make an array of arrays, but how about when dimensions get jagged? Or an array of jagged arrays of objects?

Consider one example: gift boxes under a Christmas tree.
A box might be represented as an object with several properties -

- recipient
- an array of things inside

You might want to organize them several ways -
the simplest is an array of all boxes, but what if you wanted an array of Senders, and each element of this array contained an array of boxes sent by them.

Would this be possible to represent? How would one enumerate the various arrays, or get the lengths?

What would the syntax be for the length of a Sender list?

If boxes[sender][item] was the syntax for one item, how would one get the number of items from a sender? How would one get the number of senders?

Could this data be extended to include an item name and cost? These things periodically haunt my dreams...

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu bằng cách xem lại tutorial 9.12, “2D Arrays in JavaScript”, và các ví dụ được mô tả trong issue này. Xác định phạm vi cho một tutorial nâng cao về mảng răng cưa, mảng các đối tượng, lập chỉ mục lồng nhau và việc lấy độ dài của các collection. Được xem là hoàn thành khi tutorial giải thích và minh họa rõ ràng cấu trúc dữ liệu hộp quà được đề xuất cùng các câu hỏi của nó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.