-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassi18.ts
44 lines (28 loc) · 1.53 KB
/
assi18.ts
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
32
33
34
35
36
37
38
39
//assingment:18
// Seeing the World: Think of at least five places in the world you’d like to visit.
// 0 Store the locations in a array. Make sure the array is not in alphabetical order.
// 1 Print your array in its original order.
// 2 Print your array in alphabetical order without modifying the actual list.
// 3 Show that your array is still in its original order by printing it.
// 4 Print your array in reverse alphabetical order without changing the order of the original list.
// 5 Show that your array is still in its original order by printing it again.
// 6 Reverse the order of your list. Print the array to show that its order has changed.
// 7 Reverse the order of your list again. Print the list to show it’s back to its original order.
// 8 Sort your array so it’s stored in alphabetical order. Print the array to show that its order has been changed.
// 9 Sort to change your array so it’s stored in reverse alphabetical order. Print the list to show that its order has changed.
const placeToVisit = ["Kashmir", "New York","Paris","Saudia","France"]
console.log(placeToVisit);
const result = [...placeToVisit].sort()
console.log(result);
console.log(placeToVisit);
const reverse2= [...result].reverse()
console.log(reverse2);
console.log(placeToVisit);
const reve = placeToVisit.reverse()
console.log(reve);
const rereve = placeToVisit.reverse()
console.log(rereve);
const order = placeToVisit.sort()
console.log(order);
const revOrder = placeToVisit.reverse()
console.log(revOrder);