Basic JavaScript (43/111) | Manipulate Arrays With push | freeCodeCamp

preview_player
Показать описание
Basic JavaScript (43/111) | Manipulate Arrays With push | freeCodeCamp

An easy way to append data to the end of an array is via the push() function.

.push() takes one or more parameters and "pushes" them onto the end of the array.

Examples:
var arr1 = [1,2,3];
// arr1 is now [1,2,3,4]

var arr2 = ["Stimpson", "J", "cat"];
// arr2 now equals ["Stimpson", "J", "cat", ["happy", "joy"]]
Push ["dog", 3] onto the end of the myArray variable.

Рекомендации по теме
welcome to shbcf.ru