add an Array() constructor example to the multi-dimensional-arrays theory - #353
Merged
Conversation
…eory (#313) The task is solved with Array<null>(size).fill(null).map(...), but the theory showed Array<Type> only as a way to write a type — creating an array of a given length was never covered, so the teacher's solution looked like it came out of nowhere. Added a section that separates Array<T> as an annotation from Array<T>(n) as a constructor call, shows why fill() is needed before map() (map skips empty slots), and ends with the two-dimensional case the task asks for. All three outputs were verified by compiling and running the snippets. Also stripped a pre-existing trailing space in the ru file (MD009). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
fey
force-pushed
the
fix/313-array-constructor-example
branch
from
August 5, 2026 15:25
a21d295 to
8a99cc7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #313
Решение учителя в уроке «Многомерные массивы» построено на
Array<null>(size).fill(null).map(...), но в теорииArray<Type>показан только как способ записи типа. Создание массива нужной длины через конструктор нигде не разобрано, поэтому вывести решение из материала невозможно.Добавлен раздел «Создание массива нужной длины»:
Array<T>как аннотация противArray<T>(n)как вызова конструктора, «дырявый» массив и почемуmap()пропускает пустые слоты, необходимостьfill()передmap(), и в конце — двумерный случай, который и требуется в задании.Все три вывода в комментариях проверены компиляцией и запуском (
tsc+node):Array.from()и spread не упоминаются — вне скоупа issue. Задание и решение учителя не менялись. Заодно убран лишний пробел в конце строки в ru-файле (MD009).🤖 Generated with Claude Code