scrimba
Adding to Arrays With the Push, Unshift, and Concat Methods: Part 2 of 2
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Adding to Arrays With the Push, Unshift, and Concat Methods: Part 2 of 2
AboutCommentsNotes
Adding to Arrays With the Push, Unshift, and Concat Methods: Part 2 of 2
Expand for more info
index.js
run
preview
console
const arr1 = ["?", "?", "?", "?", "?", "?"];

//Task: Create a copy of arr1 called arr2.
// Push a new item ("?") to arr2 without pushing it to arr1.















// const arr1 = ['1?', '2?'];
// const arr2 = ['3?', '4?'];
// const arr3 = ['5?', '6?'];

// const arr4 = arr1.concat(arr2, arr3);




//Task: create a fourth array (arr4) that combines arr1, arr2, and arr3











// const arr = ['First item', 'Second item', 'Third item'];

// // Task: add 'Urgent item 1' and 'Urgent item 2' to the array.

// const arrLength = arr.unshift('Urgent item 1', 'Urgent item 2');

// console.log(arrLength);













// Task: add 'Fourth item'.

// const arrLength = arr.push('Fourth item', 'Fifth item');

// console.log(arrLength);
Console
[
"1?"
,
"2?"
,
"3?"
,
"4?"
,
"5?"
,
"6?"
]
,
[
"1?"
,
"2?"
]
,
[
"3?"
,
"4?"
]
,
[
"5?"
,
"6?"
]
,
/index.html
-10:50