Skip to content

Commit f8ee24e

Browse files
committed
Add methods push and shift
1 parent ddf6b4f commit f8ee24e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

app3.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const arr = ['str1','str2',11,-4,true,false,101];
2+
3+
console.log(arr); // ['str1','str2',11,-4,true,false,101]
4+
console.log(arr[arr.length-1]); // 101
5+
console.log(arr.at(-1)); // 101
6+
7+
console.log(arr.shift()); // 'str1'
8+
console.log(arr); // ['str2',11,-4,true,false,101]
9+
10+
console.log(arr.push(55)); // 7
11+
console.log(arr); // ['str2',11,-4,true,false,101,55]
12+

0 commit comments

Comments
 (0)