Skip to content

Commit 60216cb

Browse files
author
Walle Cyril
committed
array how to add an array
1 parent 8807d35 commit 60216cb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

js/Array.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ const seventhItem = array[6];
1616
// get the length
1717
const length = array.length;
1818

19-
// add at the end
19+
// add 1 thing at the end
2020
array.push("something");
2121

22+
// add multiple things at the end
23+
array.push(4, 88, 99);
24+
25+
// add an array at the end (inlines the array)
26+
array.push(...[4, 88, 99]);
27+
2228
// add at the begining
2329
array.unshift("JS");
2430

0 commit comments

Comments
 (0)