-
Notifications
You must be signed in to change notification settings - Fork 0
/
qno18.js
32 lines (32 loc) · 1.63 KB
/
qno18.js
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
"use strict";
// Qno.18/
// Seeing the World: Think of at least five places in the world you’d like to visit.
// • Store the locations in a array. Make sure the array is not in alphabetical order.
// • Print your array in its original order.
// • Print your array in alphabetical order without modifying the actual list.
// • Show that your array is still in its original order by printing it.
// • Print your array in reverse alphabetical order without changing the order of the original list.
// • Show that your array is still in its original order by printing it again.
// • Reverse the order of your list. Print the array to show that its order has changed.
// • Reverse the order of your list again. Print the list to show it’s back to its original order.
// • Sort your array so it’s stored in alphabetical order. Print the array to show that its order has been changed.
// • Sort to change your array so it’s stored in reverse alphabetical order. Print the list to show that its order has changed.
Object.defineProperty(exports, "__esModule", { value: true });
// STEP 1:
let array = [`Istanbol`, `South Korea`, `New York`, `Bora Bora`, `Taj Mahal`, `Paris`];
// STEP 2:
console.log(`Original Order => ` + array);
// STEP 3:
console.log(`Copy => ` + [...array].sort());
// STEP 4:
console.log(`Original Order => ` + array);
// STEP 5:
console.log(`Copy => ` + [...array].sort().reverse());
// STEP 6:
console.log(`Copy => ` + [...array].sort().reverse());
// STEP 7:
console.log(`Copy => ` + [...array].sort());
// STEP 8:
console.log(`Copy => ` + [...array].sort().reverse());
// STEP 9:
console.log(`Copy => ` + [...array].sort());