Skip to content

Commit 114fdb3

Browse files
committed
part 4 done
1 parent de4ec70 commit 114fdb3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arrays/exercises/part-four-arrays.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ let holdCabinet2 = ['orange drink', 'nerf toys', 'camera', 42, 'parsnip'];
55

66
//1) Print the result of using concat on the two arrays. Does concat alter the original arrays? Verify this by printing holdCabinet1 after using the method.
77

8+
console.log(holdCabinet1.concat(holdCabinet2));
9+
console.log(holdCabinet1);
10+
//does not effect original array
11+
812
//2) Print a slice of two elements from each array. Does slice alter the original arrays?
913

14+
console.log(holdCabinet1.slice(0, 1) + "\n" + holdCabinet2.slice(0, 1));
15+
console.log(holdCabinet1);
16+
//does not effect original array
17+
1018
//3) reverse the first array, and sort the second. What is the difference between these two methods? Do the methods alter the original arrays?
19+
console.log(holdCabinet1.reverse());
20+
console.log(holdCabinet2.sort());
21+
22+
console.log(holdCabinet1);
23+
console.log(holdCabinet2);
24+
//these methods seem to alter the original arrays.

0 commit comments

Comments
 (0)