Пример генерации массива чисел на JS

This commit is contained in:
2025-09-24 23:53:08 +03:00
parent 66c1987326
commit 9410231236

View File

@@ -15,3 +15,6 @@ cats.shift(); // ['Willy', 'Mini']
// unshift(): Add items to the beginning of an array
// unshift() returns the new array length.
cats.unshift('Puff', 'George'); // ['Puff', 'George', 'Willy', 'Mini']
// Генерирует массив чисел
Array.from({length: 4}, (_, i) => i + 1) // [1, 2, 3, 4]