Skip to content

Commit fc373f5

Browse files
Merge pull request #69 from wakidurrahman/feat/array-into-02
insertion
2 parents 6295674 + 57d054e commit fc373f5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/exercises/arrays/array-01.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
11
// Introducing Arrays
22
const arrayInit: number[] = [1, 2, 3, 4];
3+
4+
// insertion
5+
const array_insertion: number[] = [1, 2, 3, 4];
6+
array_insertion.push(5);
7+
array_insertion.push(7);
8+
array_insertion.push(2);
9+
10+
// Deletion
11+
// This .pop() method removes the last-added element of the array.
12+
const array_deletion: number[] = [1, 2, 3, 4];
13+
array_deletion.pop();
14+
array_deletion.pop();
15+
16+
// This .shift() method will remove the first element and return it.
17+
array_deletion.shift();
18+
array_deletion.shift();

0 commit comments

Comments
 (0)