-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02-Array.js
More file actions
31 lines (16 loc) 路 795 Bytes
/
Copy path02-Array.js
File metadata and controls
31 lines (16 loc) 路 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
let arr=[4,5,7,2,8];
console.log(arr.slice(0,3)); // slice(* , * ); return us the particular elements in series ...
let a=[4];
let b=[9];
let c=[3];
let result=a.concat(b,c); // concat(); helps to merge two or more arrays into one....
console.log(result);
let arr=[6,9,3,2,5];
console.log(arr.toReversed()); // toReversed(); It helps to reverse the array...
let arr=[6,9,3,2,5];
console.log(arr.slice(3)); // output -> [ 2, 5 ] In these slice(*)
console.log(arr.slice(1)); // output -> [ 9, 3, 2, 5 ]
// slice(3) means:
// 馃憠 Start from index 3 and go till the end .. it ignore the element on 0, 1, 2
let arr=[8,4,9,2,3,1,0];
console.log(arr.toSorted()); // toSorted() sort the array also negative elements...