-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.js
More file actions
26 lines (17 loc) · 714 Bytes
/
Copy patharray.js
File metadata and controls
26 lines (17 loc) · 714 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
// Array Destructuring
let fruitsArray = ["apple", "banana", "orange"];
//let [first, second, third] = fruitsArray;
// console.log(first); // "apple"
// console.log(second); // "banana"
// console.log(third); // "orange"
let colors = ["red", "green", "blue", "yellow"];
let [firstColor, , thirdColor] = colors;
console.log(firstColor); // "red"
console.log(thirdColor); // "blue"
let fruitsA = ["apple", "banana", "orange", "mango", "kiwi"];
let [first, second, ...rest] = fruitsA;
console.log(first); // "apple"
console.log(second); // "banana"
console.log(rest); // ["orange", "mango", "kiwi"]
let str = "partha sarker"
console.log(str.split("").reverse().join("")); // return reverse string of str