Пример генерации массива чисел на JS
This commit is contained in:
@@ -15,3 +15,6 @@ cats.shift(); // ['Willy', 'Mini']
|
|||||||
// unshift(): Add items to the beginning of an array
|
// unshift(): Add items to the beginning of an array
|
||||||
// unshift() returns the new array length.
|
// unshift() returns the new array length.
|
||||||
cats.unshift('Puff', 'George'); // ['Puff', 'George', 'Willy', 'Mini']
|
cats.unshift('Puff', 'George'); // ['Puff', 'George', 'Willy', 'Mini']
|
||||||
|
|
||||||
|
// Генерирует массив чисел
|
||||||
|
Array.from({length: 4}, (_, i) => i + 1) // [1, 2, 3, 4]
|
||||||
|
Reference in New Issue
Block a user